-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
68 lines (52 loc) · 1.56 KB
/
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
60
61
62
63
64
65
66
67
68
# Build Cloud Platform tools (CLI)
FROM golang:1.23.2-bookworm AS cli_builder
ENV \
CGO_ENABLED=0 \
GOOS=linux \
KUBECTL_VERSION=1.29.3 \
CLOUD_PLATFORM_CLI_VERSION=DOCKER \
TERRAFORM_VERSION=1.2.5
WORKDIR /build
RUN apt update
RUN \
apt \
install \
curl \
unzip \
-y
# Build cli
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# To get the latest build tag into the image please build using docker build --build-arg CLOUD_PLATFORM_CLI_VERSION=<latest-tag> .
RUN go build -ldflags "-X github.com/ministryofjustice/cloud-platform-cli/pkg/commands.Version=${CLOUD_PLATFORM_CLI_VERSION}" -o cloud-platform .
# Install kubectl
RUN curl -sLo ./kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
# Install terraform
RUN curl -sLo terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && unzip terraform.zip
RUN chmod +x kubectl terraform
# ---
FROM debian:bookworm-20241016-slim
ENV AWSCLI_VERSION=2.7.6
RUN apt update
RUN apt install \
unzip \
groff \
ca-certificates \
curl \
git-crypt \
git \
grep \
openssl \
parallel \
python3 \
jq \
-y
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${AWSCLI_VERSION}.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install
COPY --from=cli_builder /build/cloud-platform /usr/local/bin/cloud-platform
COPY --from=cli_builder /build/kubectl /usr/local/bin/kubectl
COPY --from=cli_builder /build/terraform /usr/local/bin/terraform
CMD /bin/sh