1- # ## Builder ###
2- FROM golang:1.19.5-alpine3.17 as builder
1+ # ## Builder Go ###
2+ FROM golang:1.19.5-alpine3.17 as builder-go
33
44WORKDIR /go/src/app
55ENV GIN_MODE=release
@@ -18,6 +18,31 @@ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
1818 cd /go/src/app && \
1919 go build -mod=readonly -ldflags="-s -w" -o goapp
2020
21+
22+ # ## Builder Python ###
23+ FROM python:3.10.10-alpine${ALPINE_VERSION:-3.17} as builder-python
24+
25+ ARG AWS_CLI_VERSION=2.11.0
26+ RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
27+ RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git
28+
29+ WORKDIR aws-cli
30+ RUN python -m venv venv
31+ RUN . venv/bin/activate
32+ RUN scripts/installers/make-exe
33+ RUN unzip -q dist/awscli-exe.zip
34+ RUN aws/install --bin-dir /aws-cli-bin
35+ RUN /aws-cli-bin/aws --version
36+
37+ # reduce image size: remove autocomplete and examples
38+ RUN rm -rf \
39+ /usr/local/aws-cli/v2/current/dist/aws_completer \
40+ /usr/local/aws-cli/v2/current/dist/awscli/data/ac.index \
41+ /usr/local/aws-cli/v2/current/dist/awscli/examples
42+ RUN find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.json -delete
43+ RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete
44+
45+
2146# ## Binary ###
2247# FROM golang:1.19.5-alpine3.17
2348FROM nginx:${NGINX_VERSION:-1.23-alpine}
@@ -59,8 +84,10 @@ LABEL maintainer="$AUTHOR" \
5984 fr.hbis.docker.base.version="$BUILD_VERSION"
6085
6186ENV GIN_MODE=release
62- COPY --from=devopscorner/cicd:alpine /usr/local/bin/ /usr/local/bin/
63- COPY --from=builder /go/src/app/goapp /usr/local/bin/k8s-context
87+ COPY --from=alpine/k8s:1.26.2 /usr/bin/ /usr/local/bin/
88+ COPY --from=builder-python /usr/local/aws-cli/ /usr/local/aws-cli/
89+ COPY --from=builder-python /aws-cli-bin/ /usr/local/bin/
90+ COPY --from=builder-go /go/src/app/goapp /usr/local/bin/k8s-context
6491
6592EXPOSE 22 80 443
6693
0 commit comments