Separacion de docker para producion y desarrollo
This commit is contained in:
@@ -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
10
frontend/Dockerfile.prod
Normal 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
8
frontend/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user