refactor Dockerfile

This commit is contained in:
chshouyu 2022-09-19 02:15:51 +08:00
parent 06dec2e79b
commit 80d411f5b1
2 changed files with 21 additions and 6 deletions

10
.dockerignore Normal file
View File

@ -0,0 +1,10 @@
/**
!/module
!/plugins
!/public
!/static
!/util
!/app.js
!/server.js
!/package.json
!/package-lock.json

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" ]