-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (33 loc) · 1.21 KB
/
Dockerfile
File metadata and controls
36 lines (33 loc) · 1.21 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
# syntax=docker/dockerfile:1
FROM node:24-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
# Use npm install instead of npm ci for more flexibility with missing optional deps
RUN npm install --only=production --ignore-scripts
# Clean up any dev dependencies that might have been installed
RUN npm prune --omit=dev
FROM node:24 AS builder
WORKDIR /app
COPY . .
ARG TARGETARCH
ARG TARGETOS
RUN npm install --os=${TARGETOS} --cpu=${TARGETARCH}
RUN npm rebuild
RUN npm install --no-save --platform=linux --arch=x64 lightningcss
RUN npm install --no-save --platform=linux --arch=arm64 lightningcss
RUN npm rebuild lightningcss
RUN npm install --no-save --platform=linux --arch=x64 sharp
RUN npm install --no-save --platform=linux --arch=arm64 sharp
RUN npm rebuild sharp
RUN npm run build || (npm install --os=${TARGETOS} --cpu=${TARGETARCH} lightningcss && npm run build)
FROM node:24 AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=deps /app/node_modules ./node_modules
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.ts ./
COPY --from=builder /app/package.json ./
COPY --from=builder /app/src ./src
EXPOSE 3000
CMD ["npm", "run", "start"]