refactor Dockerfile

This commit is contained in:
chshouyu
2022-09-19 04:06:56 +08:00
parent 06dec2e79b
commit 80d411f5b1
2 changed files with 21 additions and 6 deletions
+11 -6
View File
@@ -1,11 +1,16 @@
FROM node:lts-alpine
WORKDIR /app
COPY . /app
RUN apk add --no-cache tini
RUN npm config set registry "https://registry.npmmirror.com/" \
&& npm install -g npm husky \
&& npm install --production
ENV NODE_ENV production
USER node
WORKDIR /app
COPY --chown=node:node . ./
RUN npm i --omit=dev --ignore-scripts
EXPOSE 3000
CMD ["node", "app.js"]
CMD [ "/sbin/tini", "--", "node", "app.js" ]