-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 841 Bytes
/
Dockerfile
File metadata and controls
34 lines (25 loc) · 841 Bytes
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
# Stage 1: Build frontend
FROM oven/bun:1 AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package.json frontend/bun.lock ./
RUN ["bun", "install", "--frozen-lockfile"]
COPY frontend/ ./
RUN ["bun", "run", "build"]
# Stage 2: Build Go binary
FROM golang:1.26-alpine AS go-builder
RUN apk add --no-cache tzdata
WORKDIR /app
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ .
COPY --from=frontend-builder /app/frontend/dist ./ui/dist/
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/vendel -ldflags="-s -w -X main.version=docker" .
# Stage 3: Runtime
FROM alpine:3.22
RUN apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=go-builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=go-builder /app/vendel /app/vendel
EXPOSE 8090
ENTRYPOINT ["/app/vendel"]
CMD ["serve", "--http=0.0.0.0:8090"]