From 38f3dbcd65595b625a8c52054a068a284dd3c302 Mon Sep 17 00:00:00 2001 From: "Lin, Hung-Shin" Date: Thu, 26 Oct 2023 14:20:45 +0800 Subject: [PATCH] feat: install docker cli in backend * change the copy order to improve performance --- app/Dockerfile | 2 +- server/Dockerfile | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/Dockerfile b/app/Dockerfile index 89ded80..eafe05a 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -14,9 +14,9 @@ CMD [ "yarn", "dev:docker", "--host", "0.0.0.0" ] # Build stage FROM base as build -COPY app ./app COPY packages/file-graph ./packages/file-graph COPY packages/utils ./packages/utils +COPY app ./app RUN yarn build # Production stage diff --git a/server/Dockerfile b/server/Dockerfile index 4424f7e..76fb334 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,5 +1,6 @@ FROM node:20-alpine AS build +COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/ WORKDIR /app COPY ./package.json yarn.lock ./ COPY server/package.json ./server/package.json @@ -15,23 +16,19 @@ EXPOSE 3000 # Production FROM build as prod -COPY ./server ./server COPY packages/file-graph ./packages/file-graph COPY packages/utils ./packages/utils COPY packages/models ./packages/models +COPY ./server ./server COPY quests ./quests ENV NODE_ENV=production - WORKDIR /app/server - CMD [ "yarn", "start" ] # Development FROM build as dev RUN yarn install --frozen-lockfile - ENV NODE_ENV=development - CMD [ "yarn", "server" ] \ No newline at end of file