From bc3dc0510d10b0ad4a5229afa749df0fa4c6eb39 Mon Sep 17 00:00:00 2001 From: seongha <11pi885@gmail.com> Date: Sun, 5 Jan 2025 15:28:18 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20actions=EC=97=90=20pnpm=20install?= =?UTF-8?q?=EC=9D=84=20=EC=BA=90=EC=8B=B1=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/back-media-cd.yml | 12 +++++++++++- apps/media/Dockerfile | 16 ++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/back-media-cd.yml b/.github/workflows/back-media-cd.yml index 45c5c500..b7dde468 100644 --- a/.github/workflows/back-media-cd.yml +++ b/.github/workflows/back-media-cd.yml @@ -29,6 +29,14 @@ jobs: node-version: ${{ matrix.node-version }} cache: 'pnpm' + - name: ๐Ÿ”„ ์บ์‹œ ๋ณต์› + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + - name: โฌ‡๏ธ ์˜์กด์„ฑ ์„ค์น˜ run: pnpm install --frozen-lockfile @@ -65,8 +73,10 @@ jobs: - name: ๐Ÿณ Docker ๋นŒ๋“œ ๋ฐ ํ‘ธ์‹œ run: | echo "Starting Docker build..." - DOCKER_BUILDKIT=1 docker buildx build --progress=plain --no-cache -f apps/media/Dockerfile . -t my-media-app + DOCKER_BUILDKIT=1 docker buildx build --progress=plain --build-arg PNPM_CACHE_DIR=/root/.pnpm-store -f apps/media/Dockerfile . -t my-media-app + echo "Docker build completed." + - name: ๐Ÿณ Docker ์‹คํ–‰ run: | echo "Starting Docker container..." diff --git a/apps/media/Dockerfile b/apps/media/Dockerfile index 00dfa342..aa539dde 100644 --- a/apps/media/Dockerfile +++ b/apps/media/Dockerfile @@ -20,7 +20,11 @@ RUN pnpm install -g turbo@^2.2.3 # ์˜์กด์„ฑ ํŒŒ์ผ๋งŒ ์šฐ์„  ๋ณต์‚ฌํ•˜์—ฌ ์บ์‹œ ํ™œ์šฉ COPY package.json pnpm-lock.yaml ./ -RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --frozen-lockfile + +# PNPM ์บ์‹œ ๋””๋ ‰ํ† ๋ฆฌ ์ „๋‹ฌ +ARG PNPM_CACHE_DIR=/pnpm/store +RUN pnpm install --frozen-lockfile --store=${PNPM_CACHE_DIR} + # ์†Œ์Šค ํŒŒ์ผ ์ „์ฒด ๋ณต์‚ฌ COPY . . @@ -38,15 +42,15 @@ WORKDIR /app COPY --from=builder /app/out/json/ . COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml -# ์บ์‹œ ํ™œ์šฉํ•˜์—ฌ ์˜์กด์„ฑ ์„ค์น˜ -RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --frozen-lockfile + +# PNPM ์บ์‹œ ๋””๋ ‰ํ† ๋ฆฌ ์ „๋‹ฌ +ARG PNPM_CACHE_DIR=/pnpm/store +RUN pnpm install --frozen-lockfile --store=${PNPM_CACHE_DIR} # ์ „์ฒด ์†Œ์Šค ๋ณต์‚ฌ ๋ฐ ๋นŒ๋“œ COPY --from=builder /app/out/full/ . -# ์ด๊ณณ์—์„œ ์บ์‹œ๋ฅผ ํ™œ์šฉํ•˜์—ฌ C++ ๋ชจ๋“ˆ์˜ ์ปดํŒŒ์ผ ๊ฒฐ๊ณผ๋ฅผ ์บ์‹ฑํ•ฉ๋‹ˆ๋‹ค. -RUN --mount=type=cache,id=build-cache,target=/root/.cache \ - pnpm build:media +RUN pnpm build:media # ํ™˜๊ฒฝ ํŒŒ์ผ ๋ณต์‚ฌ COPY --from=builder /app/apps/media/.env /app/apps/media/dist/.env