[add] docker env
This commit is contained in:
parent
c44dac2cfd
commit
c24174ceb5
@ -1,5 +1,5 @@
|
|||||||
# sudo docker build -t guesswhoiams .
|
# sudo docker build -t guesswhoiams .
|
||||||
# # sudo docker exec -it 51bd6c84a7f2 /bin/bash
|
# sudo docker exec -it 5cac9af04256 /bin/bash
|
||||||
|
|
||||||
FROM node:19.4.0
|
FROM node:19.4.0
|
||||||
|
|
||||||
@ -16,20 +16,21 @@ ADD . /src
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# clean
|
# clean
|
||||||
RUN npm prune --production
|
RUN npm prune --prod
|
||||||
|
|
||||||
# move
|
# move
|
||||||
RUN rm -rf /app \
|
RUN rm -rf /app \
|
||||||
&& mv dist /app \
|
&& mv dist /app \
|
||||||
|
&& mv .env /app \
|
||||||
&& mv node_modules /app/ \
|
&& mv node_modules /app/ \
|
||||||
&& rm -rf /src
|
&& rm -rf /src
|
||||||
|
|
||||||
# ENV
|
# ENV
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV prod
|
||||||
|
|
||||||
EXPOSE 3003
|
EXPOSE 3003
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# 指定啟動container後執行命令
|
# 指定啟動container後執行命令
|
||||||
CMD node index.js
|
CMD NODE_ENV=prod && node index.js
|
||||||
# CMD [ "npm", "start" ]
|
# CMD [ "npm", "start" ]
|
Loading…
Reference in New Issue
Block a user