-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (27 loc) · 1.11 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (27 loc) · 1.11 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
41
42
43
44
# ── Stage 1: Development (hot-reload with Air) ────────────────
FROM golang:1.24-alpine AS dev
RUN apk add --no-cache git curl make
WORKDIR /app
# Install Air for hot-reload
RUN go install github.com/air-verse/air@latest
COPY go.mod go.sum ./
RUN go mod download
CMD ["air"]
# ── Stage 2: Builder ──────────────────────────────────────────
FROM golang:1.24-alpine AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o taskflow .
# ── Stage 3: Production (minimal image) ───────────────────────
FROM alpine:3.20 AS production
RUN apk add --no-cache ca-certificates curl
WORKDIR /app
COPY --from=builder /build/taskflow .
COPY --from=builder /build/static ./static
COPY --from=builder /build/*.html ./
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl --silent --fail http://localhost:8080/healthz || exit 1
CMD ["./taskflow"]