-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
33 lines (26 loc) · 1015 Bytes
/
Dockerfile
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
# syntax=docker/dockerfile:1.4
### builder ###
FROM golang:1.22-bullseye as builder
WORKDIR /workspace
# Copy the Go Modules
COPY --link go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
COPY . .
# Build
ARG GOOS=linux
ARG GOARCH=amd64
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags="-s -w" -trimpath -tags timetzdata -o dkw cmd/dkw/main.go
### runner ###
FROM gcr.io/distroless/static-debian11:nonroot
LABEL org.opencontainers.image.authors="Yoshitaka Fujii, Hiroki Okui, Kohei Ota"
LABEL org.opencontainers.image.url="https://github.com/cloudnativedaysjp/dreamkast-weaver"
LABEL org.opencontainers.image.source="https://github.com/cloudnativedaysjp/dreamkast-weaver/blob/main/Dockerfile"
EXPOSE 8080
WORKDIR /
COPY --link internal internal
COPY --link --from=builder /workspace/dkw .
ENTRYPOINT ["/dkw"]