From 4abd312761e9ccc20fd7108ed0b1e98f1763c6a5 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 3 Jan 2020 22:17:30 +0100 Subject: [PATCH] [DEV] basic version of the docker file for web application --- front/Dockerfile | 33 ++++++++++++++++++++++++++++----- front/Dockerfile.dev | 24 ++++++++++++++++++++++++ front/docker-compose.yaml | 3 ++- front/package-lock.json | 6 +++--- front/package.json | 10 +++++----- 5 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 front/Dockerfile.dev diff --git a/front/Dockerfile b/front/Dockerfile index ce20363..71a56c0 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -1,16 +1,39 @@ # base image -FROM node:latest +FROM node:latest as build ADD src /application/src +ADD e2e /application/e2e +ADD package-lock.json /application/ ADD package.json /application/ +ADD angular.json /application/ +ADD browserslist /application/ +ADD karma.conf.js /application/ +ADD protractor.conf.js /application/ +ADD tsconfig.json /application/ +ADD tslint.json /application/ WORKDIR /application/ -# add `/app/node_modules/.bin` to $PATH -ENV PATH /app/node_modules/.bin:$PATH +# add `/application/node_modules/.bin` to $PATH +ENV PATH /application/node_modules/.bin:$PATH # install and cache app dependencies RUN npm install -# start app -CMD ["ng", "serve", "--host", "0.0.0.0"] +# generate build +RUN ng build --output-path=dist +############ +### prod ### +############ + +# base image +FROM nginx:1.16.0-alpine + +# copy artifact build from the 'build environment' +COPY --from=build /application/dist /usr/share/nginx/html + +# expose port 80 +EXPOSE 80 + +# run nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/front/Dockerfile.dev b/front/Dockerfile.dev new file mode 100644 index 0000000..b554e2c --- /dev/null +++ b/front/Dockerfile.dev @@ -0,0 +1,24 @@ +# base image +FROM node:latest + +ADD src /application/src +ADD e2e /application/e2e +ADD package-lock.json /application/ +ADD package.json /application/ +ADD angular.json /application/ +ADD browserslist /application/ +ADD karma.conf.js /application/ +ADD protractor.conf.js /application/ +ADD tsconfig.json /application/ +ADD tslint.json /application/ +WORKDIR /application/ + +# add `/app/node_modules/.bin` to $PATH +ENV PATH /app/node_modules/.bin:$PATH + +# install and cache app dependencies +RUN npm install + +# start app +CMD ["npx", "ng", "serve", "--host", "0.0.0.0"] + diff --git a/front/docker-compose.yaml b/front/docker-compose.yaml index d6765af..0d2bcb1 100755 --- a/front/docker-compose.yaml +++ b/front/docker-compose.yaml @@ -6,5 +6,6 @@ services: image: yui.heero/karideo container_name: karideo ports: - - 15081:4200 + #- 15081:4200 + - 15081:80 diff --git a/front/package-lock.json b/front/package-lock.json index a4e596e..7ed90b1 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -10521,9 +10521,9 @@ "dev": true }, "typescript": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", - "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", "dev": true }, "uglify-js": { diff --git a/front/package.json b/front/package.json index 060dcbd..3550da9 100644 --- a/front/package.json +++ b/front/package.json @@ -31,19 +31,19 @@ "@angular/compiler-cli": "^8.2.14", "@angular/language-service": "^8.2.14", "@types/jasmine": "^3.5.0", - "@types/jasminewd2": "x", + "@types/jasminewd2": "^2.0.8", "@types/node": "^13.1.2", "codelyzer": "^5.0.1", "jasmine-core": "^3.5.0", - "jasmine-spec-reporter": "x", + "jasmine-spec-reporter": "^4.2.1", "karma": "^4.4.1", "karma-chrome-launcher": "^3.1.0", "karma-coverage-istanbul-reporter": "^2.1.1", "karma-jasmine": "^2.0.1", "karma-jasmine-html-reporter": "^1.5.1", - "protractor": "x", + "protractor": "^5.4.2", "ts-node": "^8.5.4", - "tslint": "x", - "typescript": "^3.6.0" + "tslint": "^5.20.1", + "typescript": "~3.5.0" } }