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:
|
test-frontend:
|
||||||
runs-on: [ci]
|
runs-on: [ci]
|
||||||
if: false
|
# if: false
|
||||||
#needs: test-backend
|
#needs: test-backend
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -176,7 +176,7 @@ jobs:
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
runs-on: [ci]
|
runs-on: [ci]
|
||||||
if: false
|
# if: false
|
||||||
#needs: [test-backend, test-frontend]
|
#needs: [test-backend, test-frontend]
|
||||||
needs: [test-frontend]
|
needs: [test-frontend]
|
||||||
|
|
||||||
|
|
@ -212,6 +212,7 @@ jobs:
|
||||||
|
|
||||||
deploy-prod:
|
deploy-prod:
|
||||||
runs-on: [prod]
|
runs-on: [prod]
|
||||||
|
needs: [build-frontend]
|
||||||
#needs: [build-backend, build-frontend]
|
#needs: [build-backend, build-frontend]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
@ -285,5 +286,5 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
apk add --no-cache curl >/dev/null
|
apk add --no-cache curl >/dev/null
|
||||||
curl -sS -D- http://127.0.0.1:18080/healthz
|
curl -sS -D- http://127.0.0.1:8080/healthz
|
||||||
curl -sS -I http://127.0.0.1:18080/
|
curl -sS -I http://127.0.0.1:8080/
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,8 @@ spec:
|
||||||
value: "${PROD_BACKEND_PORT}"
|
value: "${PROD_BACKEND_PORT}"
|
||||||
- name: PORT
|
- name: PORT
|
||||||
value: "${PROD_FRONTEND_PORT}"
|
value: "${PROD_FRONTEND_PORT}"
|
||||||
- name: HOST
|
- name: HOSTNAME
|
||||||
value: "0.0.0.0"
|
value: "127.0.0.1"
|
||||||
ports:
|
ports:
|
||||||
- containerPort: ${PROD_FRONTEND_PORT}
|
- containerPort: ${PROD_FRONTEND_PORT}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ FROM docker.io/node:20-alpine AS builder
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
|
|
@ -13,6 +15,8 @@ RUN npm ci
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
|
@ -20,29 +24,30 @@ RUN npm run build
|
||||||
FROM docker.io/node:20-alpine AS runner
|
FROM docker.io/node:20-alpine AS runner
|
||||||
|
|
||||||
# Create non-root user
|
# Create non-root user
|
||||||
RUN addgroup --system --gid 1001 nodejs
|
RUN addgroup --system --gid 1001 nodejs \
|
||||||
RUN adduser --system --uid 1001 nextjs
|
&& adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy necessary files from builder
|
# Copy standalone artifacts
|
||||||
COPY --from=builder /app/public ./public
|
COPY --from=builder /app/public ./public
|
||||||
COPY --from=builder /app/.next/standalone ./
|
COPY --from=builder /app/.next/standalone ./
|
||||||
COPY --from=builder /app/.next/static ./.next/static
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
|
||||||
# Change ownership
|
# Ownership
|
||||||
RUN chown -R nextjs:nodejs /app
|
RUN chown -R nextjs:nodejs /app
|
||||||
|
|
||||||
# Switch to non-root user
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
# Expose port
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV HOSTNAME=127.0.0.1
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Health check
|
# Healthcheck: hit the frontend root over IPv4 (no curl needed)
|
||||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
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
|
# Run the application
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
Loading…
Add table
Reference in a new issue