diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 9ceeba3..7e592c0 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: test-frontend: runs-on: [ci] - if: false + # if: false #needs: test-backend steps: @@ -176,7 +176,7 @@ jobs: build-frontend: runs-on: [ci] - if: false + # if: false #needs: [test-backend, test-frontend] needs: [test-frontend] @@ -212,6 +212,7 @@ jobs: deploy-prod: runs-on: [prod] + needs: [build-frontend] #needs: [build-backend, build-frontend] env: @@ -285,5 +286,5 @@ jobs: run: | set -euo pipefail apk add --no-cache curl >/dev/null - curl -sS -D- http://127.0.0.1:18080/healthz - curl -sS -I http://127.0.0.1:18080/ + curl -sS -D- http://127.0.0.1:8080/healthz + curl -sS -I http://127.0.0.1:8080/ diff --git a/deploy/prod-pod.yml b/deploy/prod-pod.yml index 495da29..9a79470 100644 --- a/deploy/prod-pod.yml +++ b/deploy/prod-pod.yml @@ -129,8 +129,8 @@ spec: value: "${PROD_BACKEND_PORT}" - name: PORT value: "${PROD_FRONTEND_PORT}" - - name: HOST - value: "0.0.0.0" + - name: HOSTNAME + value: "127.0.0.1" ports: - containerPort: ${PROD_FRONTEND_PORT} protocol: TCP diff --git a/frontend/Dockerfile b/frontend/Dockerfile index aa2431d..eb45502 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -4,6 +4,8 @@ FROM docker.io/node:20-alpine AS builder # Set working directory WORKDIR /app +ENV NODE_ENV=development + # Copy package files COPY package*.json ./ @@ -13,6 +15,8 @@ RUN npm ci # Copy source code COPY . . +ENV NEXT_TELEMETRY_DISABLED=1 + # Build the application RUN npm run build @@ -20,29 +24,30 @@ RUN npm run build FROM docker.io/node:20-alpine AS runner # Create non-root user -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs +RUN addgroup --system --gid 1001 nodejs \ + && adduser --system --uid 1001 nextjs -# Set working directory WORKDIR /app -# Copy necessary files from builder +# Copy standalone artifacts COPY --from=builder /app/public ./public COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/static ./.next/static -# Change ownership +# Ownership RUN chown -R nextjs:nodejs /app - -# Switch to non-root user USER nextjs -# Expose port +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 +ENV PORT=3000 +ENV HOSTNAME=127.0.0.1 + EXPOSE 3000 -# Health check +# Healthcheck: hit the frontend root over IPv4 (no curl needed) HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD curl -f http://localhost:3000/api/health || exit 1 + CMD wget -qO- http://127.0.0.1:${PORT}/ >/dev/null 2>&1 || exit 1 # Run the application CMD ["node", "server.js"] \ No newline at end of file