35 lines
820 B
Plaintext
35 lines
820 B
Plaintext
|
###################
|
||
|
# BUILD FOR LOCAL DEVELOPMENT
|
||
|
###################
|
||
|
FROM node:16-alpine AS development
|
||
|
WORKDIR /app/
|
||
|
COPY --chown=node:node package*.json ./
|
||
|
RUN npm ci
|
||
|
COPY --chown=node:node . .
|
||
|
USER node
|
||
|
|
||
|
###################
|
||
|
# BUILD FOR PRODUCTION
|
||
|
###################
|
||
|
FROM node:16-alpine AS build
|
||
|
WORKDIR /app/
|
||
|
COPY --chown=node:node package*.json ./
|
||
|
COPY --chown=node:node --from=development /app/node_modules ./node_modules
|
||
|
COPY --chown=node:node . .
|
||
|
RUN npm run build
|
||
|
ENV NODE_ENV production
|
||
|
RUN npm ci --only=production && npm cache clean --force
|
||
|
USER node
|
||
|
|
||
|
###################
|
||
|
# PRODUCTION
|
||
|
###################
|
||
|
FROM nginx:stable-alpine AS nginx
|
||
|
|
||
|
ARG PORT=9999
|
||
|
|
||
|
COPY --from=build /app/dist/ /usr/share/nginx/html/
|
||
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
|
||
|
EXPOSE ${PORT}
|
||
|
CMD ["nginx", "-g", "daemon off;" ]
|