34 lines
830 B
Docker
34 lines
830 B
Docker
###################
|
|
# 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/
|
|
ENV NODE_ENV production
|
|
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
|
|
RUN npm ci --only=production && npm cache clean --force
|
|
USER node
|
|
|
|
###################
|
|
# PRODUCTION
|
|
###################
|
|
FROM nginx:stable-alpine AS nginx
|
|
|
|
COPY --from=build /app/dist/ /usr/share/nginx/html/
|
|
COPY --from=build /app/run.sh /app/
|
|
COPY --from=build /app/nginx.conf /configs/
|
|
RUN chmod +x /app/run.sh
|
|
|
|
CMD ["/app/run.sh"] |