-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (20 loc) · 752 Bytes
/
Dockerfile
File metadata and controls
29 lines (20 loc) · 752 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
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.25 as build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG VERSION
ARG GIT_COMMIT
ARG PUBLIC_KEY
ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOFLAGS=-mod=vendor
WORKDIR /go/src/github.com/self-actuated/slicer-ssh-agent
COPY . .
# RUN CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test -v ./...
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
--ldflags "-s -w -X 'main.Version=${VERSION}' -X 'main.GitCommit=${GIT_COMMIT}'" \
-o slicer-ssh-agent .
FROM --platform=${TARGETPLATFORM:-linux/amd64} scratch as ship
COPY --from=build /go/src/github.com/self-actuated/slicer-ssh-agent/slicer-ssh-agent /
CMD ["/slicer-ssh-agent"]