-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (32 loc) · 848 Bytes
/
Copy pathDockerfile
File metadata and controls
44 lines (32 loc) · 848 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
# Multi-stage build
FROM golang:1.22-alpine AS builder
WORKDIR /build
# Install dependencies
RUN apk add --no-cache git ca-certificates tzdata
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build
ARG VERSION=dev
ARG BUILD_TIME
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-w -s -X main.Version=${VERSION} -X main.BuildTime=${BUILD_TIME}" \
-o /app/refill ./cmd/refill
# Final image
FROM alpine:latest
# Install runtime dependencies
RUN apk add --no-cache ca-certificates tzdata
# Copy binary
COPY --from=builder /app/refill /usr/local/bin/refill
# Create working directory
WORKDIR /data
# Set timezone
ENV TZ=UTC
# Health check
HEALTHCHECK --interval=5m --timeout=3s \
CMD refill check || exit 1
# Default command
ENTRYPOINT ["refill"]
CMD ["scheduler", "start"]