From 943ec5a9ff778af263ece9e1820efc9725a0ba2c Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Mon, 23 Sep 2024 00:53:22 +0200 Subject: [PATCH] ci: setup postbuild instead of handling it in Dockerfile --- .github/workflows/deploy.yml | 3 +-- Dockerfile | 3 --- package.json | 1 + 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2206742..60b8857 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,8 +17,7 @@ jobs: key: ${{ secrets.KEY }} port: ${{ secrets.PORT }} script: | + cd ${GITHUB_REPOSITORY##*/} git pull - bun run build - cd docs docker compose down docker compose up -d diff --git a/Dockerfile b/Dockerfile index b6bf37f..b16432f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,14 +34,11 @@ ENV SKIP_ENV_VALIDATION=true RUN addgroup --system --gid 1002 nodejs && \ adduser --system --uid 1002 nextjs -COPY --from=builder /app/public ./public - # Set the correct permission for prerender cache RUN mkdir .next && chown nextjs:nodejs .next # Automatically leverage output traces to reduce image size COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs diff --git a/package.json b/package.json index fc02ee3..4b7093b 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "biome check --write", "prebuild": "next telemetry disable", "build": "next build", + "postbuild": "next-sitemap && mkdir -p .next/standalone/public .next/standalone/.next/static && cp -r public/* .next/standalone/public && cp -r .next/static/* .next/standalone/.next/static", "start": "bun run .next/standalone/server.js", "db:start": "docker-compose up db", "db:generate": "drizzle-kit generate",