Try arm64 build
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m5s
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m5s
This commit is contained in:
27
Dockerfile
27
Dockerfile
@@ -1,41 +1,38 @@
|
||||
# ── Stage 1: Build frontend ──────────────────────────────────────────────────
|
||||
FROM node:20-alpine AS builder
|
||||
FROM node:20-bullseye-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build tools needed for native modules and frontend build
|
||||
RUN apk add --no-cache python3 build-base sqlite-dev
|
||||
# Install build tools and sqlite headers for native modules
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 build-essential libsqlite3-dev ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
# Produce production node_modules (compile native modules here for the target arch)
|
||||
RUN npm ci --omit=dev && npm cache clean --force
|
||||
|
||||
# ── Stage 2: Production image ───────────────────────────────────────────────
|
||||
FROM node:20-alpine
|
||||
|
||||
FROM node:20-bullseye-slim
|
||||
|
||||
# Allow forcing build from source (useful when prebuilt binaries are not available)
|
||||
ARG BUILD_FROM_SOURCE=false
|
||||
ENV npm_config_build_from_source=${BUILD_FROM_SOURCE}
|
||||
|
||||
# Install build tools and sqlite dev headers for compiling native modules
|
||||
RUN apk add --no-cache python3 build-base sqlite-dev
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --omit=dev && npm cache clean --force
|
||||
|
||||
# Remove build tools after install to keep image smaller
|
||||
RUN apk del build-base python3
|
||||
# Copy production node_modules and built frontend from builder stage
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Copy server code
|
||||
COPY server/ ./server/
|
||||
|
||||
# Copy built frontend from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Create uploads directory
|
||||
RUN mkdir -p uploads/avatars uploads/branding
|
||||
|
||||
|
||||
Reference in New Issue
Block a user