-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (38 loc) · 1.75 KB
/
Dockerfile
File metadata and controls
54 lines (38 loc) · 1.75 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# syntax=docker/dockerfile:1
#--- Builder stage ---
FROM golang:1.26.1-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod,id=kubeaid-cli-gomodcache \
go mod download
ARG VERSION=dev
ARG COMMIT=unknown
ARG BUILD_DATE=unknown
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod,id=kubeaid-cli-gomodcache \
CGO_ENABLED=0 go build \
-ldflags="-s -w \
-X github.com/Obmondo/kubeaid-bootstrap-script/cmd/kubeaid-core/root/version.Version=${VERSION} \
-X github.com/Obmondo/kubeaid-bootstrap-script/cmd/kubeaid-core/root/version.Commit=${COMMIT} \
-X github.com/Obmondo/kubeaid-bootstrap-script/cmd/kubeaid-core/root/version.Date=${BUILD_DATE}" \
-v -o /usr/local/bin/kubeaid-core ./cmd/kubeaid-core
#--- Dependencies layer ---
FROM alpine:3.22 AS runtime-dependencies-installer
RUN apk add --no-cache bash curl wget unzip
COPY scripts/install-runtime-dependencies.sh /opt/install-runtime-dependencies.sh
# We want to bundle dependencies for all the cloud providers,
# into the KubeAid Bootstrap Script container image.
ENV CLOUD_PROVIDER=all
RUN /opt/install-runtime-dependencies.sh
#--- Packager stage ---
FROM alpine:3.22 AS packager
LABEL org.opencontainers.image.authors="archisman@obmondo.com,ashish@obmondo.com"
LABEL org.opencontainers.image.url="https://github.com/Obmondo/kubeaid-cli"
LABEL org.opencontainers.image.source="https://github.com/Obmondo/kubeaid-cli"
LABEL org.opencontainers.image.vendor="Obmondo"
LABEL org.opencontainers.image.licenses="GPL3"
ENV PATH=$PATH:/usr/local/bin:/usr/bin:/bin
RUN apk add --no-cache bash grep
COPY --from=builder /usr/local/bin/kubeaid-core /usr/local/bin/kubeaid-core
COPY --from=runtime-dependencies-installer /usr/local/bin /usr/local/bin
ENTRYPOINT [ "kubeaid-core" ]