-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
64 lines (46 loc) · 1.62 KB
/
Dockerfile.frontend
File metadata and controls
64 lines (46 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Frontend Dockerfile for automated deployments (CI/CD)
# This Dockerfile is used by docker-publish-frontend.yml workflow
# It copies the frontend directory from the repository root
# ---- Build Stage ----
FROM node:24-alpine AS builder
ARG VYMANAGER_VERSION=dev
ARG VYMANAGER_ENV=production
ENV NEXT_PUBLIC_VYMANAGER_VERSION=${VYMANAGER_VERSION}
ENV NEXT_PUBLIC_VYMANAGER_ENV=${VYMANAGER_ENV}
WORKDIR /app
# Install required system packages
RUN apk add --no-cache openssl
# Copy package files and prisma schema first for better caching
COPY frontend/package*.json ./
COPY frontend/prisma ./prisma/
COPY frontend/next.config.* ./
# Install all dependencies (including dev) for the build
RUN npm install --include=dev
# Copy application code
COPY frontend/ .
# Generate Prisma Client
RUN npx prisma generate
# Build Next.js for production
ENV NODE_ENV=production
ENV BETTER_AUTH_SECRET=dummy_secret_for_build_only
ENV BACKEND_URL=http://backend:8000
RUN npm run build
# ---- Production Runtime Stage ----
FROM node:24-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Install netcat for health checks and wait scripts
RUN apk add --no-cache netcat-openbsd
# Copy only necessary production artifacts
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
# Copy and set entrypoint script
COPY frontend/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose port
EXPOSE 3000
# Use entrypoint script
ENTRYPOINT ["docker-entrypoint.sh"]