This repository has been archived on 2024-06-14. You can view files and clone it, but cannot push or open issues or pull requests.
icynet-auth-server/Dockerfile

51 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2022-11-27 08:14:01 +00:00
###################
# BUILD FOR LOCAL DEVELOPMENT
###################
FROM node:18-alpine As development
USER node
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN npm ci
COPY --chown=node:node . .
###################
# BUILD FOR PRODUCTION
###################
FROM node:18-alpine As build
USER node
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
COPY --chown=node:node . .
RUN npm run build
ENV NODE_ENV production
RUN npm ci --omit=dev && npm cache clean --force
###################
# PRODUCTION
###################
FROM node:18-alpine As production
USER node
WORKDIR /app
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
COPY --chown=node:node --from=build /usr/src/app/views ./views
COPY --chown=node:node --from=build /usr/src/app/public ./public
COPY --chown=node:node --from=build /usr/src/app/package*.json ./package*.json
CMD [ "node", "dist/main.js" ]