forked from AdamRussak/k8f
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (24 loc) · 810 Bytes
/
Dockerfile
File metadata and controls
27 lines (24 loc) · 810 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
FROM golang:1.24-alpine AS build
COPY ./.git /tmp/build/.git
COPY ./cmd /tmp/build/cmd
COPY ./core /tmp/build/core
COPY ./provider /tmp/build/provider
COPY ./provider /tmp/build/provider
COPY *.go /tmp/build/
COPY go.mod /tmp/build/
COPY go.sum /tmp/build/
WORKDIR /tmp/build
RUN ls -alh .
RUN apk update \
&& apk add --no-cache \
git
RUN version=$(git describe --tags --always --abbrev=0 --match='[0-9]*.[0-9]*.[0-9]*' 2> /dev/null)
RUN echo $version
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo ${arch} && CGO_ENABLED=0 GOOS=linux GOARCH=${arch} go build -ldflags="-X 'k8f/cmd.tversion=${version}'" .
FROM alpine:3.18.2
RUN addgroup -S nonroot \
&& adduser -S nonroot -G nonroot
USER nonroot
RUN mkdir -p ~/.aws
COPY --from=build /tmp/build/k8f .
ENTRYPOINT ["./k8f" ]