-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
46 lines (32 loc) · 1.24 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
45
46
FROM golang:1.26-alpine AS builder
ENV GOCACHE=/root/.cache/go-build
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \
--mount=type=cache,target=/var/lib/apk,sharing=locked \
apk add --no-cache \
--repository="https://dl-cdn.alpinelinux.org/alpine/edge/main" \
--repository="https://dl-cdn.alpinelinux.org/alpine/edge/community" \
"build-base=0.5-r4" \
"libheif-dev=1.21.2-r2"
WORKDIR /app
RUN --mount=type=cache,target=/go/pkg/mod \
go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
RUN sqlc generate
RUN --mount=type=cache,target="/root/.cache/go-build" \
CGO_ENABLED=1 go build \
-ldflags="-s -w" \
-o govd ./cmd/main.go
FROM alpine:3.22 AS runtime
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \
--mount=type=cache,target=/var/lib/apk,sharing=locked \
apk add --no-cache \
--repository="https://dl-cdn.alpinelinux.org/alpine/edge/main" \
--repository="https://dl-cdn.alpinelinux.org/alpine/edge/community" \
"ffmpeg=8.0.1-r3" \
"libheif=1.21.2-r2"
COPY --from=builder /app/govd ./govd
ENTRYPOINT ["./govd"]