You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iassure-wx/Dockerfile

60 lines
1.6 KiB

2 years ago
# ################################################################
# ### Base image ###
# ################################################################
FROM node:16-alpine as base
WORKDIR /opt
ENV NODE_ENV production
2 years ago
RUN apk update && \
apk upgrade && \
npm i npm@latest -g && \
chown node:node -R /opt
# && \
# apk add --no-cache bash && \
# apk add --no-cache git && \
2 years ago
COPY --chown=node:node package*.json ./
2 years ago
USER node
# ################################################################
# ### build image ###
2 years ago
# ################################################################
FROM base as build
2 years ago
ENV NODE_ENV development
2 years ago
COPY --chown=node:node . .
2 years ago
RUN npm install && npm cache clean --force
ENV PATH /opt/node_modules/.bin:$PATH
2 years ago
RUN tsc -p ./tsconfig.node.json && \
resolve-tspaths --out "dist" && \
npm run spa-build
2 years ago
# ################################################################
# ### modules image ###
2 years ago
# ################################################################
FROM base as modules
2 years ago
RUN npm install && npm cache clean --force
2 years ago
# ################################################################
# ### production image ###
# ################################################################
FROM base as production
COPY --from=build --chown=node:node /opt/dist ./dist
COPY --from=modules --chown=node:node /opt/node_modules ./node_modules
2 years ago
COPY --chown=node:node ./wx-config.* ./
2 years ago
CMD node dist/backend/app.js