[mod] docker
This commit is contained in:
parent
d66e142ed5
commit
cce15b366d
15
Dockerfile
15
Dockerfile
@ -1,11 +1,9 @@
|
|||||||
# sudo docker build -t guesswhoiams .
|
# sudo docker build -t guesswhoiams .
|
||||||
# sudo docker exec -it 5cac9af04256 /bin/bash
|
# sudo docker ps
|
||||||
|
# sudo docker exec -it [Container ID] /bin/bash
|
||||||
|
|
||||||
FROM node:19.4.0
|
FROM node:19.4.0
|
||||||
|
|
||||||
# 使用淘宝 NPM 镜像(国内机器构建推荐启用)
|
|
||||||
# RUN npm config set registry https://registry.npm.taobao.org/
|
|
||||||
|
|
||||||
# npm install
|
# npm install
|
||||||
ADD package*.json /src/
|
ADD package*.json /src/
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
@ -21,8 +19,6 @@ RUN npm prune --prod
|
|||||||
# move
|
# move
|
||||||
RUN rm -rf /app \
|
RUN rm -rf /app \
|
||||||
&& mv dist /app \
|
&& mv dist /app \
|
||||||
&& mv certificate /app \
|
|
||||||
&& mv .env /app \
|
|
||||||
&& mv node_modules /app/ \
|
&& mv node_modules /app/ \
|
||||||
&& rm -rf /src
|
&& rm -rf /src
|
||||||
|
|
||||||
@ -32,6 +28,13 @@ ENV NODE_ENV prod
|
|||||||
EXPOSE 3003
|
EXPOSE 3003
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# copy static
|
||||||
|
ADD .env /app/
|
||||||
|
ADD certificate /app/certificate/
|
||||||
|
# COPY [".env", "./"]
|
||||||
|
# COPY ["certificate", "./certificate"]
|
||||||
|
|
||||||
# 指定啟動container後執行命令
|
# 指定啟動container後執行命令
|
||||||
# CMD NODE_ENV=prod && node index.js
|
# CMD NODE_ENV=prod && node index.js
|
||||||
CMD [ "npm", "run", "prod" ]
|
CMD [ "npm", "run", "prod" ]
|
Loading…
Reference in New Issue
Block a user