Separacion de docker para producion y desarrollo

This commit is contained in:
2021-07-13 23:59:45 -04:00
parent 7723cad823
commit 4b71bc67aa
7 changed files with 92 additions and 5 deletions

View File

@@ -1,9 +1,8 @@
FROM node:alpine as build
WORKDIR /angular
COPY package.json package-lock.json /angular/
RUN npm install
COPY . /angular
RUN npm run build --prod
FROM nginx:stable-alpine
COPY --from=build /angular/dist/frontend /usr/share/nginx/html
ENTRYPOINT ["npm", "run", "start"]

10
frontend/Dockerfile.prod Normal file
View File

@@ -0,0 +1,10 @@
FROM node:alpine as build
WORKDIR /angular
COPY package.json package-lock.json /angular/
RUN npm install
COPY . /angular
RUN npm run build --prod
FROM nginx:stable-alpine
COPY --from=build /angular/dist/frontend /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf

8
frontend/nginx.conf Normal file
View File

@@ -0,0 +1,8 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}

View File

@@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"start": "ng serve --host 0.0.0.0",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"