-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
35 lines (21 loc) · 781 Bytes
/
Dockerfile.api
File metadata and controls
35 lines (21 loc) · 781 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
FROM golang:1.26-alpine AS builder
WORKDIR /app
RUN apk add --no-cache git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-X main.version=${VERSION}" -o blob-indexer-api ./cmd/api
FROM alpine:3.23
WORKDIR /app
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -g 1000 -S appgroup \
&& adduser -u 1000 -S appuser -G appgroup
COPY --from=builder /app/blob-indexer-api .
COPY --from=builder /app/internal/db/migrations ./internal/db/migrations
RUN chown -R appuser:appgroup /app
USER 1000
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:8080/api/status || exit 1
CMD ["./blob-indexer-api"]