Change Dockerfiles and docker-compose file
The reason for this change is to reduce the image size for the different containers
This commit is contained in:
parent
e32ab08b7d
commit
6a3d510cad
7 changed files with 74 additions and 29 deletions
|
@ -1,8 +1,12 @@
|
|||
node_modules
|
||||
npm-debug.log
|
||||
build
|
||||
.dockerignore
|
||||
**/node_modules/
|
||||
**/.git
|
||||
**/.DS_Store
|
||||
**/node_modules
|
||||
.env
|
||||
**/README.md
|
||||
**/LICENSE
|
||||
**/.vscode
|
||||
**/npm-debug.log
|
||||
**/coverage
|
||||
**/.env
|
||||
**/.editorconfig
|
||||
**/.aws
|
||||
**/dist
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM node:latest
|
||||
FROM node:slim AS build
|
||||
|
||||
# set working directory
|
||||
WORKDIR /app
|
||||
|
@ -10,7 +10,9 @@ ENV PATH /app/node_modules/.bin:$PATH
|
|||
COPY package.json ./
|
||||
COPY package-lock.json ./
|
||||
|
||||
RUN npm install
|
||||
RUN npm install && npm cache clean --force
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
# add app
|
||||
COPY . ./
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
FROM node:latest as build
|
||||
FROM node:slim as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV PATH /app/node_modules/.bin:$PATH
|
||||
|
||||
COPY package.json ./
|
||||
COPY package-lock.json ./
|
||||
RUN npm ci --silent
|
||||
COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:latest
|
||||
RUN npm ci --production && npm cache clean --force
|
||||
COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
RUN apk -U upgrade
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY nginx/nginx.conf /etc/nginx/conf.d
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue