diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 26f03c5..3a1c4b0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -104,17 +104,36 @@ jobs: - name: Verify artifact & build image run: | set -euo pipefail + echo "== artifact root ==" + ls -la prebuilt + echo "== artifact .next ==" + ls -la prebuilt/.next + test -f prebuilt/server.js test -f prebuilt/.next/BUILD_ID test -d prebuilt/.next/static test -d prebuilt/node_modules test -f prebuilt/Dockerfile + # Drop legacy root static from context if present (Next deprecation) + rm -rf prebuilt/static + docker build -t "$IMAGE_NAME" prebuilt - # Confirm BUILD_ID is actually inside the image - docker run --rm --entrypoint sh "$IMAGE_NAME" -c \ - 'test -f /app/.next/BUILD_ID && test -f /app/server.js && test -d /app/.next/static && test ! -e /app/static && ls -la /app && ls -la /app/.next' + echo "== image checks ==" + docker run --rm --entrypoint sh "$IMAGE_NAME" -c ' + set -e + ls -la /app + ls -la /app/.next + test -f /app/server.js || { echo "FAIL: missing /app/server.js"; exit 1; } + test -f /app/.next/BUILD_ID || { echo "FAIL: missing /app/.next/BUILD_ID"; exit 1; } + test -d /app/.next/static || { echo "FAIL: missing /app/.next/static"; exit 1; } + if [ -e /app/static ]; then + echo "FAIL: legacy /app/static still present" + exit 1 + fi + echo "OK: runtime files present" + ' - name: Restart container env: diff --git a/Dockerfile.prebuilt b/Dockerfile.prebuilt index c5db2a1..2db5867 100644 --- a/Dockerfile.prebuilt +++ b/Dockerfile.prebuilt @@ -15,6 +15,9 @@ RUN addgroup --system --gid 1001 nodejs \ # Single COPY of an already-complete app root (avoids missing hidden .next) COPY --chown=nextjs:nodejs . ./ +# Next warns/breaks if a legacy root-level ./static exists alongside ./public +RUN rm -rf ./static + USER nextjs EXPOSE 3000 CMD ["node", "server.js"]