fix(docker): update frontend Dockerfile for Podman compatibility
- Remove deprecated --only=production flag - Add default value for NEXT_PUBLIC_API_URL build arg - Add BuildKit cache mount for npm - Remove HEALTHCHECK (not supported by Podman OCI format)
This commit is contained in:
parent
632fc78982
commit
cb31713307
1 changed files with 6 additions and 9 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# =============================================================================
|
||||
# GoHorse Jobs Frontend - Optimized Production Dockerfile
|
||||
# =============================================================================
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Stage 1: Dependencies
|
||||
|
|
@ -9,10 +10,10 @@ FROM mirror.gcr.io/library/node:20-alpine AS deps
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies only when needed
|
||||
# Install ALL dependencies (dev + prod) for build stage
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --only=production --ignore-scripts && \
|
||||
npm cache clean --force
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci && npm cache clean --force
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Stage 2: Builder
|
||||
|
|
@ -25,8 +26,8 @@ WORKDIR /app
|
|||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Build arguments for environment
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
# Build arguments for environment (with sensible default)
|
||||
ARG NEXT_PUBLIC_API_URL=http://localhost:8080
|
||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
|
||||
# Build the application
|
||||
|
|
@ -61,8 +62,4 @@ USER nextjs
|
|||
|
||||
EXPOSE 3000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD wget -qO- http://localhost:3000 || exit 1
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue