-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev.Dockerfile
59 lines (42 loc) · 1.23 KB
/
dev.Dockerfile
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
55
56
57
58
59
# Stage 1 Build myks
FROM --platform=$BUILDPLATFORM golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY . .
RUN go mod download \
&& go mod verify
RUN CGO_ENABLED=0 \
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o myks main.go
# Stage 2 Download tools
FROM --platform=$BUILDPLATFORM debian:bookworm AS download-tools
ARG TARGETOS
ARG TARGETARCH
# renovate: datasource=github-releases depName=helm/helm
ARG HELM_VERSION=v3.14.3
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
unzip
WORKDIR /tools
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -fsSL \
https://get.helm.sh/helm-v${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz \
| tar -xzf - --strip-components=1 ${TARGETOS}-${TARGETARCH}/helm
RUN chmod +x *
# Stage 3: Bring it all together
FROM --platform=$BUILDPLATFORM debian:bookworm
WORKDIR /app
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
git \
gnupg2 \
ssh \
tini \
&& rm -rf /var/lib/apt/lists/*
COPY --from=download-tools /tools/* /usr/local/bin/
COPY --from=builder /app/myks /usr/local/bin/
WORKDIR /app
ENTRYPOINT ["tini", "--", "myks"]