Change frontend build process to set IPv4
Some checks failed
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Successful in 12s
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Failing after 1m47s
Podman Rootless Demo / deploy-prod (push) Has been skipped
Some checks failed
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Successful in 12s
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Failing after 1m47s
Podman Rootless Demo / deploy-prod (push) Has been skipped
This commit is contained in:
parent
e7386cfffd
commit
6d0a3ceb18
3 changed files with 22 additions and 16 deletions
|
|
@ -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/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
Loading…
Add table
Reference in a new issue