From d8082db61d57d0f3cea97064f8be42d0ade7b800 Mon Sep 17 00:00:00 2001 From: lukestahl Date: Mon, 23 Oct 2023 10:42:23 +0200 Subject: [PATCH] fix pnpm docker build --- .dockerignore | 5 +++++ .github/workflows/deploy-api.yml | 2 +- apps/api/Dockerfile => Dockerfile | 4 ++-- package.json | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .dockerignore rename apps/api/Dockerfile => Dockerfile (86%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..958b26c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.git +.gitignore +*.md +dist \ No newline at end of file diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml index 4426e74..8f7f26a 100644 --- a/.github/workflows/deploy-api.yml +++ b/.github/workflows/deploy-api.yml @@ -72,7 +72,7 @@ jobs: uses: docker/build-push-action@v3 with: file: 'Dockerfile' - context: '{{defaultContext}}:apps/api' + context: '.' platforms: linux/amd64 push: true tags: ${{ steps.docker-meta.outputs.tags }} diff --git a/apps/api/Dockerfile b/Dockerfile similarity index 86% rename from apps/api/Dockerfile rename to Dockerfile index bf93a09..ff958c0 100644 --- a/apps/api/Dockerfile +++ b/Dockerfile @@ -10,10 +10,10 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-l FROM base AS build RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile -RUN pnpm run build +RUN pnpm run build:api FROM base COPY --from=prod-deps /app/node_modules /app/node_modules -COPY --from=build /app/dist /app/dist +COPY --from=build /app/apps/api/dist /app/dist EXPOSE 3000 CMD [ "pnpm", "start:prod" ] \ No newline at end of file diff --git a/package.json b/package.json index 6b8d52f..27f9d27 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "fix": "manypkg fix", "lint": "pnpm run --filter \"{apps/*}\" --stream --parallel lint", "build": "pnpm run --filter \"{apps/*}\" --stream --parallel build", + "build:api": "pnpm run --filter @acme/api build", + "start:prod": "pnpm run --filter @acme/api start:prod", "upgrade:tamagui": "pnpm up '*tamagui*'@latest '@tamagui/*'@latest react-native-web-lite@latest", "check-deps": "check-dependency-version-consistency ." },