docker) build app with node instead of bun
All checks were successful
PR Checks / lint-test-and-docker-build (pull_request) Successful in 4m9s
All checks were successful
PR Checks / lint-test-and-docker-build (pull_request) Successful in 4m9s
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -1,5 +1,5 @@
|
||||
# ── Build stage ────────────────────────────────────────────────────────────────
|
||||
FROM oven/bun:1 AS builder
|
||||
FROM node:22-bookworm-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -9,27 +9,25 @@ RUN apt-get update \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy dependency manifests first for better layer caching
|
||||
COPY package.json bun.lock ./
|
||||
COPY package.json ./
|
||||
|
||||
# Install all deps (including devDependencies needed for the build).
|
||||
# better-sqlite3 is a native module — it must be compiled here on Linux,
|
||||
# not copied from a macOS node_modules.
|
||||
RUN bun install --frozen-lockfile
|
||||
RUN npm install
|
||||
|
||||
# Copy source and build
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
RUN npm run build
|
||||
|
||||
# Prune to production-only deps, recompiling native modules for Linux
|
||||
RUN bun install --frozen-lockfile --production
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
# ── Runtime stage ───────────────────────────────────────────────────────────────
|
||||
FROM node:22-alpine AS runtime
|
||||
FROM node:22-bookworm-slim AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Create a non-root user to run the app
|
||||
RUN addgroup -S trips && adduser -S trips -G trips
|
||||
RUN groupadd --system trips && useradd --system --gid trips trips
|
||||
|
||||
# Copy the built app and production node_modules from the builder
|
||||
COPY --from=builder /app/build ./build
|
||||
|
||||
Reference in New Issue
Block a user