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 ──────────────────────────────────────────────────
|
# ── Stage 1: Build frontend ──────────────────────────────────────────────────
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-bullseye-slim AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install build tools needed for native modules and frontend build
|
# Install build tools and sqlite headers for native modules
|
||||||
RUN apk add --no-cache python3 build-base sqlite-dev
|
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* ./
|
COPY package.json package-lock.json* ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
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 ───────────────────────────────────────────────
|
# ── 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)
|
# Allow forcing build from source (useful when prebuilt binaries are not available)
|
||||||
ARG BUILD_FROM_SOURCE=false
|
ARG BUILD_FROM_SOURCE=false
|
||||||
ENV npm_config_build_from_source=${BUILD_FROM_SOURCE}
|
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
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json package-lock.json* ./
|
# Copy production node_modules and built frontend from builder stage
|
||||||
RUN npm ci --omit=dev && npm cache clean --force
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
COPY --from=builder /app/dist ./dist
|
||||||
# Remove build tools after install to keep image smaller
|
|
||||||
RUN apk del build-base python3
|
|
||||||
|
|
||||||
# Copy server code
|
# Copy server code
|
||||||
COPY server/ ./server/
|
COPY server/ ./server/
|
||||||
|
|
||||||
# Copy built frontend from builder stage
|
|
||||||
COPY --from=builder /app/dist ./dist
|
|
||||||
|
|
||||||
# Create uploads directory
|
# Create uploads directory
|
||||||
RUN mkdir -p uploads/avatars uploads/branding
|
RUN mkdir -p uploads/avatars uploads/branding
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user