-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 986 Bytes
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 986 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
# Copyright 2025 Kristopher Rahim Afful-Brown. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# syntax=docker/dockerfile:1.7-labs
# (i.e. 'cgr.dev', 'docker.io')
ARG REGISTRY=docker.io
FROM --platform=${BUILDPLATFORM} ${REGISTRY}/chainguard/go AS go
WORKDIR /src
ARG TARGETOS TARGETARCH
ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
COPY go.* .
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go mod download
FROM go AS build
# only really needed for CGO deps (like SQLite, etc.)
ENV CGO_ENABLED=0
COPY . .
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go build \
-tags=osusergo,netgo,timetzdata \
-o=/usr/local/bin/a.out ./cmd/daemon/
FROM ${REGISTRY}/chainguard/static
COPY --from=build /usr/local/bin /usr/local/bin
ENTRYPOINT [ "a.out" ]