Commit d41df5f1 authored by Administrator's avatar Administrator

Update Dockerfile.frontend via Son of Anton

parent 51958eda
FROM node:20-alpine AS base FROM node:20-alpine AS builder
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /build
# Copy everything needed # Copy shared
COPY frontend/package*.json ./ COPY shared/ ./shared/
# Install frontend deps
COPY frontend/package.json frontend/package-lock.json* ./frontend/
WORKDIR /build/frontend
RUN npm install --legacy-peer-deps RUN npm install --legacy-peer-deps
COPY frontend/ ./ # Copy frontend source
COPY shared/ ../shared/ WORKDIR /build
COPY frontend/ ./frontend/
WORKDIR /build/frontend
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
# Build needs env vars at build time for Next.js
ARG NEXT_PUBLIC_API_URL
ARG NEXT_PUBLIC_WS_URL
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_WS_URL=$NEXT_PUBLIC_WS_URL
RUN npm run build RUN npm run build
# Production # ---- Production ----
FROM node:20-alpine AS runner FROM node:20-alpine
RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=base /app/.next/standalone ./ COPY --from=builder /build/frontend/.next/standalone ./
COPY --from=base /app/.next/static ./.next/static COPY --from=builder /build/frontend/.next/static ./.next/static
COPY --from=base /app/public ./public COPY --from=builder /build/frontend/public ./public 2>/dev/null || true
EXPOSE 3000 EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:3000/ || exit 1
CMD ["node", "server.js"] CMD ["node", "server.js"]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment