-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (26 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (26 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ─── Stage 0: Build frontend ────────────────────────────────
FROM node:22-alpine AS frontend-builder
WORKDIR /src
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci 2>/dev/null || npm install
COPY frontend/ .
ARG VITE_API_BASE
ENV VITE_API_BASE=${VITE_API_BASE}
RUN npm run build
# ─── Stage 1: Build Go binary ───────────────────────────────
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS go-builder
ARG TARGETOS TARGETARCH
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -ldflags="-s -w" -o /build/kitchen
# ─── Stage 2: Go binary runner ──────────────────────────────
FROM alpine:3.21 AS kitchen
RUN apk --no-cache add ca-certificates tini
COPY --from=go-builder /build/kitchen /usr/bin/kitchen
COPY --from=frontend-builder /src/dist /assets/dist
EXPOSE 3080
ENTRYPOINT ["tini", "--"]
CMD ["/usr/bin/kitchen"]