-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
45 lines (32 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
35
36
37
38
39
40
41
42
43
44
45
# Stage 1: build
FROM node:24-alpine AS builder
WORKDIR /app
ENV NODE_ENV=production
# Install dependencies (uses yarn if yarn.lock exists)
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Pass in NEXT_PUBLIC_API_BASE_URL from Docker build args
ARG NEXT_PUBLIC_API_BASE_URL
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
ARG NEXT_PUBLIC_MSS_EDITOR_BASE_URL
ENV NEXT_PUBLIC_MSS_EDITOR_BASE_URL=$NEXT_PUBLIC_MSS_EDITOR_BASE_URL
ARG NEXT_PUBLIC_MSS_API_BASE_URL
ENV NEXT_PUBLIC_MSS_API_BASE_URL=$NEXT_PUBLIC_MSS_API_BASE_URL
# Copy source and build
COPY . .
RUN yarn build
# Stage 2: serve with node
FROM node:24-alpine
WORKDIR /app
ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime.
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs && 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
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD [ "node", "server.js" ]