mirror of
https://github.com/luxfi/bank.git
synced 2026-10-30 17:02:07 +00:00
Modules declare go 1.27.1 and the build images follow. go fix applied the modernizers; omitzero is not applied, since it changes what the JSON says. Co-authored-by: Hanzo Dev <[email protected]>
39 lines
1.3 KiB
Docker
39 lines
1.3 KiB
Docker
# Lux Financial customer dashboard (@luxfi/bank-dash).
|
|
#
|
|
# Stage 1 builds the Vite SPA. Stage 2 builds the tiny stdlib static+proxy
|
|
# server (dashd) that serves it and forwards /v1 to bankd — no nginx/caddy.
|
|
|
|
# ---- web build ----
|
|
# Node 22: corepack pulls the latest pnpm, which requires the node:sqlite
|
|
# built-in (absent on Node 20).
|
|
# The SPA bundle is arch-independent, so build it once on the build machine
|
|
# rather than under emulation for each target.
|
|
FROM --platform=$BUILDPLATFORM node:22-alpine AS web
|
|
WORKDIR /app
|
|
RUN corepack enable
|
|
# .npmrc carries node-linker=hoisted + the @hanzogui hoist patterns the
|
|
# @hanzo/gui umbrella needs to resolve at build time — copy it BEFORE install.
|
|
COPY package.json pnpm-lock.yaml .npmrc ./
|
|
RUN pnpm install --frozen-lockfile
|
|
COPY . .
|
|
RUN pnpm build
|
|
|
|
# ---- server build ----
|
|
FROM --platform=$BUILDPLATFORM golang:1.27.1-alpine AS srv
|
|
ENV GOTOOLCHAIN=auto
|
|
WORKDIR /src
|
|
COPY server/go.mod ./
|
|
RUN go mod download
|
|
COPY server/ ./
|
|
ARG TARGETARCH
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -trimpath -ldflags "-s -w" -o /dashd .
|
|
|
|
# ---- runtime ----
|
|
FROM alpine:3.22
|
|
RUN apk add --no-cache ca-certificates
|
|
COPY --from=srv /dashd /usr/local/bin/dashd
|
|
COPY --from=web /app/dist /app/dist
|
|
ENV DIST_DIR=/app/dist PORT=3000
|
|
EXPOSE 3000
|
|
ENTRYPOINT ["dashd"]
|