first commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Stage 1 — build frontend
|
||||
FROM node:20-alpine AS frontend-build
|
||||
WORKDIR /app
|
||||
COPY packages/frontend/package.json ./
|
||||
RUN npm install
|
||||
COPY packages/frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2 — compile API to a self-contained binary
|
||||
FROM oven/bun:1-alpine AS api-build
|
||||
WORKDIR /app
|
||||
COPY packages/api/package.json packages/api/bun.lock* ./
|
||||
RUN bun install
|
||||
COPY packages/api/src ./src
|
||||
RUN bun build --compile --minify src/index.ts --outfile server
|
||||
|
||||
# Stage 3 — minimal runtime (no bun, no node_modules)
|
||||
FROM alpine:3
|
||||
RUN apk add --no-cache ca-certificates libstdc++
|
||||
WORKDIR /app
|
||||
COPY --from=api-build /app/server ./server
|
||||
COPY --from=frontend-build /app/dist ./public
|
||||
ENV PORT=4500
|
||||
EXPOSE 4500
|
||||
CMD ["./server"]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Single-stage runtime image. Nothing is compiled here — the frontend bundle
|
||||
# and the API binary are built in CI (see .github/workflows/release.yml) and
|
||||
# copied in. Mirrors the floci-io/floci "native-package" approach.
|
||||
#
|
||||
# Expected build context layout:
|
||||
# public/ frontend production bundle (arch-independent)
|
||||
# native/${TARGETARCH}/server bun-compiled API binary, one per arch
|
||||
FROM alpine:3
|
||||
|
||||
# Automatically set by Docker BuildKit to "amd64" or "arm64".
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN apk add --no-cache ca-certificates libstdc++
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --chmod=755 native/${TARGETARCH}/server ./server
|
||||
COPY public/ ./public/
|
||||
|
||||
ENV PORT=4500
|
||||
EXPOSE 4500
|
||||
|
||||
CMD ["./server"]
|
||||
Reference in New Issue
Block a user