-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 1.13 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (24 loc) · 1.13 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
# syntax=docker/dockerfile:1
# Multi-stage production image: Next.js static export inside Docker, served by nginx.
# Supabase credentials via BuildKit secrets (not ARG/ENV — avoids layer leakage + scanner warnings).
# CI validation uses local Supabase (host.docker.internal:54321); publish uses cloud URL.
FROM node:24.18.1-alpine3.24 AS builder
RUN corepack enable && corepack prepare [email protected] --activate
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
ARG NEXT_PUBLIC_SITE_URL=https://95gabor.me
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL
RUN --mount=type=secret,id=supabase_url \
--mount=type=secret,id=supabase_publishable_key \
export SUPABASE_URL="$(cat /run/secrets/supabase_url)" && \
export SUPABASE_PUBLISHABLE_KEY="$(cat /run/secrets/supabase_publishable_key)" && \
pnpm run generate
# --- Production Stage ---
FROM nginx:1.31.3-alpine3.24-slim AS production
RUN rm -f /usr/share/nginx/html/index.html
COPY --from=builder /app/out /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]