[DEV] basic version of the docker file for web application

This commit is contained in:
Edouard DUPIN 2020-01-03 22:17:30 +01:00
parent 4d63bbf37a
commit 4abd312761
5 changed files with 62 additions and 14 deletions

View File

@ -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;"]

24
front/Dockerfile.dev Normal file
View File

@ -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"]

View File

@ -6,5 +6,6 @@ services:
image: yui.heero/karideo
container_name: karideo
ports:
- 15081:4200
#- 15081:4200
- 15081:80

View File

@ -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": {

View File

@ -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"
}
}