-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (24 loc) · 780 Bytes
/
Dockerfile
File metadata and controls
37 lines (24 loc) · 780 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
FROM golang:1.26-alpine AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG ENVIRONMENT
ARG GIT_COMMIT
ARG TAG_NAME
ENV CGO_ENABLED=0
RUN go build -trimpath -a \
-tags "netgo,osusergo,static_build" \
-installsuffix netgo \
-ldflags "-s -w \
-X github.com/k0sproject/k0sctl/version.Environment=${ENVIRONMENT} \
-X github.com/carlmjohnson/versioninfo.Revision=${GIT_COMMIT} \
-X github.com/carlmjohnson/versioninfo.Version=${TAG_NAME} \
-extldflags '-static'" \
-o /out/k0sctl .
FROM docker.io/library/alpine:latest
RUN apk add --no-cache tini openssh ca-certificates
COPY --from=builder /out/k0sctl /usr/local/bin/k0sctl
ENTRYPOINT ["/sbin/tini", "--"]
USER 65534:65534
CMD ["k0sctl"]