-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (29 loc) · 928 Bytes
/
Dockerfile
File metadata and controls
48 lines (29 loc) · 928 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Build frontend
FROM node:25.8.1-alpine AS frontend-builder
RUN npm install -g pnpm
WORKDIR /app
COPY web/package.json web/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY web/ .
RUN pnpm build
# Build backend
FROM golang:1.26.1-alpine AS backend-builder
WORKDIR /app
RUN apk add --no-cache git gcc musl-dev
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Embed built frontend into binary
COPY --from=frontend-builder /app/build/client ./internal/web/dist
ARG VERSION=dev
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags "-s -w -X main.version=${VERSION}" -o main cmd/api/main.go
# Final stage
FROM alpine:3.23
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=backend-builder /app/main .
RUN mkdir -p /app/data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
CMD ["./main"]