gohorsejobs/frontend/Dockerfile
Tiago Yamamoto 11b40fe700 fix: corrige URLs do frontend para HTTPS e SSL do seeder
- Frontend: adiciona API_URL e BACKOFFICE_URL como variáveis runtime
- Seeder: corrige parsing de sslmode do DATABASE_URL
- Seeder: aumenta timeout do healthcheck para 30s
2026-02-17 10:14:57 -06:00

60 lines
1.6 KiB
Docker

# Stage 1: Base
FROM node:22-alpine AS base
WORKDIR /app
# Stage 2: Dependencies
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
# Install dependencies using npm
RUN npm install
# Stage 3: Builder
FROM base AS builder
ENV NODE_OPTIONS="--max-old-space-size=512"
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY package.json next.config.* tsconfig.json postcss.config.mjs ./
# Copy other necessary files
COPY public ./public
COPY src ./src
COPY messages ./messages
# Build arguments (Preserved from original)
ARG NEXT_PUBLIC_API_URL=http://localhost:8521
ARG NEXT_PUBLIC_BACKOFFICE_URL=http://localhost:3001
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_BACKOFFICE_URL=$NEXT_PUBLIC_BACKOFFICE_URL
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build && \
rm -rf node_modules/.cache .next/cache
# Stage 4: Production Runner
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Runtime environment variables (read by /api/config endpoint)
# These can be overridden at container runtime
ARG API_URL=https://api-local.gohorsejobs.com
ARG BACKOFFICE_URL=https://b-local.gohorsejobs.com
ENV API_URL=$API_URL
ENV BACKOFFICE_URL=$BACKOFFICE_URL
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]