[add] docker env

This commit is contained in:
建喵 2023-09-11 15:48:54 +08:00
parent c44dac2cfd
commit c24174ceb5

View File

@ -1,5 +1,5 @@
# sudo docker build -t guesswhoiams .
# # sudo docker exec -it 51bd6c84a7f2 /bin/bash
# sudo docker exec -it 5cac9af04256 /bin/bash
FROM node:19.4.0
@ -16,20 +16,21 @@ ADD . /src
RUN npm run build
# clean
RUN npm prune --production
RUN npm prune --prod
# move
RUN rm -rf /app \
&& mv dist /app \
&& mv .env /app \
&& mv node_modules /app/ \
&& rm -rf /src
# ENV
ENV NODE_ENV production
ENV NODE_ENV prod
EXPOSE 3003
WORKDIR /app
# 指定啟動container後執行命令
CMD node index.js
CMD NODE_ENV=prod && node index.js
# CMD [ "npm", "start" ]