19 lines
465 B
Docker
19 lines
465 B
Docker
# Stage 1: build
|
|
FROM golang:1.22-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# Cache dependency downloads separately from source changes.
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o queue .
|
|
|
|
# Stage 2: minimal runtime image
|
|
# alpine (not scratch) so the filesystem supports the bbolt DB file at /data.
|
|
FROM alpine:3.19
|
|
RUN mkdir -p /data
|
|
COPY --from=builder /app/queue /queue
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/queue"]
|