From c24174ceb5acb4916d0499f8d2937ce37f351c3c Mon Sep 17 00:00:00 2001 From: JianMiau Date: Mon, 11 Sep 2023 15:48:54 +0800 Subject: [PATCH] [add] docker env --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5801d5..04b5cd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] \ No newline at end of file