-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 1012 Bytes
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 1012 Bytes
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
ARG BUILDER_PLATFORM=linux/amd64
# 1) base image for the final container (native, multi-arch)
FROM node:22-alpine AS base
WORKDIR /app
# 2) builder base (FORCED to amd64 due to nextjs build issues on armv6/v7)
FROM --platform=${BUILDER_PLATFORM} oven/bun:1-alpine AS base-build
WORKDIR /app
# 3) deps + build, all on amd64 still
FROM base-build AS deps-build
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
FROM deps-build AS builder
COPY . .
RUN bun run build
# 4) the runner stage, multi-arch from now on
FROM base AS runner
ENV NODE_ENV=production
LABEL org.opencontainers.image.source="https://github.com/GabeDuarteM/blocky-ui"
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"]