diff --git a/.dockerignore b/.dockerignore index 352f66a..535ee8e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,6 @@ +.DS_Store +.git +.github blobs coverage dist diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7f401a7..80f98a1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,9 +32,9 @@ jobs: - name: Build and push image to Dockerhub uses: docker/build-push-action@v5 with: - context: . - file: ./Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64/v8 + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 817ef9d..5cb2699 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -67,6 +67,8 @@ jobs: uses: actions/checkout@v4 - name: Set up buildx uses: docker/setup-buildx-action@v3 + - name: Expose GitHub Runtime for caching + uses: crazy-max/ghaction-github-runtime@v3 - name: Build docker images run: docker compose build - name: Test API with turborepo diff --git a/Dockerfile b/Dockerfile index 0d51997..b64557a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,15 +25,13 @@ RUN apk --no-cache add tini WORKDIR /garden-snail -RUN chown -R node:node . -COPY --chown=node:node package.json pnpm-lock.yaml ./ +COPY package.json pnpm-lock.yaml ./ # with NODE_ENV=production pnpm will not install devDependencies ENV NODE_ENV=production RUN pnpm install --frozen-lockfile -COPY --from=builder --chown=node:node /garden-snail/dist ./dist +COPY --from=builder /garden-snail/dist ./dist -USER node EXPOSE 3000 ENTRYPOINT ["/sbin/tini", "node", "dist/main"] diff --git a/compose.yml b/compose.yml index 7034cde..ad72911 100644 --- a/compose.yml +++ b/compose.yml @@ -1,10 +1,19 @@ services: garden-snail: - build: . + build: + context: . + cache_from: + - type=gha + cache_to: + - type=gha,mode=max ports: - "3000:3000" test: build: context: integration + cache_from: + - type=gha + cache_to: + - type=gha,mode=max depends_on: - garden-snail