From 301abd46b33bdcc6f0398fd20a15e5f84ef8acdc Mon Sep 17 00:00:00 2001 From: Daniele Monti <62102073+Monska85@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:38:14 +0200 Subject: [PATCH] feat(upgrade): upgrade version of AWS CLI, python and alpine --- .github/workflows/docker-publish.yml | 32 +++++++++++----------- Dockerfile | 11 +++++--- Makefile | 41 +++++++++++++--------------- README.md | 7 +++-- 4 files changed, 46 insertions(+), 45 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index ab14862..b535b5e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -19,12 +19,10 @@ jobs: matrix: tag: # To keep the number of builds low, we only keep the latest two versions of the AWS CLI - - 2.15.14-3.18 - - 2.15.14-3.17 - - 2.15.14-3.16 - - 2.15.0-3.18 - - 2.15.0-3.17 - - 2.15.0-3.16 + - 2.15.42-3.11.9-3.19 + - 2.15.42-3.11.9-3.18 + - 2.15.14-3.11.9-3.19 + - 2.15.14-3.11.9-3.18 steps: - uses: actions/checkout@v4 @@ -36,8 +34,9 @@ jobs: run: | echo "latest_image_tag=$(make print-latest-image-tag)" >> "$GITHUB_OUTPUT" echo "aws_cli_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')" >> "$GITHUB_OUTPUT" - echo "alpine_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT" - echo "static_tag=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')-alpine$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT" + echo "python_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT" + echo "alpine_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[3]}')" >> "$GITHUB_OUTPUT" + echo "static_tag=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')-alpine$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[3]}')" >> "$GITHUB_OUTPUT" - name: Extract metadata (tags, labels) for Docker id: meta @@ -58,6 +57,7 @@ jobs: context: . build-args: | AWS_CLI_VERSION=${{ steps.vars.outputs.aws_cli_version }} + PYTHON_VERSION=${{ steps.vars.outputs.python_version }} ALPINE_VERSION=${{ steps.vars.outputs.alpine_version }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -69,12 +69,10 @@ jobs: matrix: tag: # To keep the number of builds low, we only keep the latest two versions of the AWS CLI - - 2.15.14-3.18 - - 2.15.14-3.17 - - 2.15.14-3.16 - - 2.15.0-3.18 - - 2.15.0-3.17 - - 2.15.0-3.16 + - 2.15.42-3.11.9-3.19 + - 2.15.42-3.11.9-3.18 + - 2.15.14-3.11.9-3.19 + - 2.15.14-3.11.9-3.18 steps: - uses: actions/checkout@v4 @@ -94,8 +92,9 @@ jobs: run: | echo "latest_image_tag=$(make print-latest-image-tag)" >> "$GITHUB_OUTPUT" echo "aws_cli_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')" >> "$GITHUB_OUTPUT" - echo "alpine_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT" - echo "static_tag=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')-alpine$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT" + echo "python_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')" >> "$GITHUB_OUTPUT" + echo "alpine_version=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[3]}')" >> "$GITHUB_OUTPUT" + echo "static_tag=$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')-alpine$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[3]}')" >> "$GITHUB_OUTPUT" - name: Extract metadata (tags, labels) for Docker id: meta @@ -116,6 +115,7 @@ jobs: context: . build-args: | AWS_CLI_VERSION=${{ steps.vars.outputs.aws_cli_version }} + PYTHON_VERSION=${{ steps.vars.outputs.python_version }} ALPINE_VERSION=${{ steps.vars.outputs.alpine_version }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index eeec717..7796ba3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ -ARG ALPINE_VERSION=3.18 +ARG PYTHON_VERSION=3.11.9 +ARG ALPINE_VERSION=3.19 -FROM python:3.10.11-alpine${ALPINE_VERSION} as builder +FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} as builder ARG AUTHOR -ARG ALPINE_VERSION=3.18 +ARG PYTHON_VERSION=3.11.9 +ARG ALPINE_VERSION=3.19 ARG IMAGE_NAME=spark-alpine-aws-cli -ARG AWS_CLI_VERSION=2.15.14 +ARG AWS_CLI_VERSION=2.15.42 # Build process +# If you want to see the AWS CLI v2 documentation, remember to go to the `v2` branch. RUN apk add --no-cache git unzip groff build-base libffi-dev cmake WORKDIR / RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git diff --git a/Makefile b/Makefile index cf80d61..98fac84 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,37 @@ AUTHOR ?= sparkfabrik IMAGE_NAME ?= docker-alpine-aws-cli PLATFORM ?= "linux/amd64" -LATEST_VERSION ?= 2.15.14-alpine3.18 +LATEST_VERSION ?= 2.15.42-alpine3.19 -build: build-2.15.14-3.18 +build: build-2.15.42-3.19 # To keep the number of builds low, we only keep the latest two versions of the AWS CLI -build-2.15.14-3.18: AWS_CLI_VERSION="2.15.14" -build-2.15.14-3.18: ALPINE_VERSION="3.18" -build-2.15.14-3.18: build-template - -build-2.15.14-3.17: AWS_CLI_VERSION="2.15.14" -build-2.15.14-3.17: ALPINE_VERSION="3.17" -build-2.15.14-3.17: build-template +build-2.15.42-3.19: AWS_CLI_VERSION="2.15.42" +build-2.15.42-3.19: PYTHON_VERSION="3.11.9" +build-2.15.42-3.19: ALPINE_VERSION="3.19" +build-2.15.42-3.19: build-template -build-2.15.14-3.16: AWS_CLI_VERSION="2.15.14" -build-2.15.14-3.16: ALPINE_VERSION="3.16" -build-2.15.14-3.16: build-template +build-2.15.42-3.18: AWS_CLI_VERSION="2.15.42" +build-2.15.42-3.18: PYTHON_VERSION="3.11.9" +build-2.15.42-3.18: ALPINE_VERSION="3.18" +build-2.15.42-3.18: build-template -build-2.15.0-3.18: AWS_CLI_VERSION="2.15.0" -build-2.15.0-3.18: ALPINE_VERSION="3.18" -build-2.15.0-3.18: build-template +build-2.15.14-3.19: AWS_CLI_VERSION="2.15.14" +build-2.15.14-3.19: PYTHON_VERSION="3.11.9" +build-2.15.14-3.19: ALPINE_VERSION="3.19" +build-2.15.14-3.19: build-template -build-2.15.0-3.17: AWS_CLI_VERSION="2.15.0" -build-2.15.0-3.17: ALPINE_VERSION="3.17" -build-2.15.0-3.17: build-template - -build-2.15.0-3.16: AWS_CLI_VERSION="2.15.0" -build-2.15.0-3.16: ALPINE_VERSION="3.16" -build-2.15.0-3.16: build-template +build-2.15.14-3.18: AWS_CLI_VERSION="2.15.14" +build-2.15.14-3.18: PYTHON_VERSION="3.11.9" +build-2.15.14-3.18: ALPINE_VERSION="3.18" +build-2.15.14-3.18: build-template build-template: docker buildx build --load . \ --platform "$(PLATFORM)" \ --build-arg AUTHOR=$(AUTHOR) \ --build-arg IMAGE_NAME=$(IMAGE_NAME) \ + --build-arg PYTHON_VERSION=$(PYTHON_VERSION) \ --build-arg ALPINE_VERSION=$(ALPINE_VERSION) \ --build-arg AWS_CLI_VERSION=$(AWS_CLI_VERSION) \ -t $(AUTHOR)/$(IMAGE_NAME):$(AWS_CLI_VERSION)-alpine$(ALPINE_VERSION) diff --git a/README.md b/README.md index af6803b..d4df69a 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ Docker image for AWS-CLI v2 on Alpine Linux. You can import the compiled binary created in this image in your Alpine Linux image. ```bash -FROM ghcr.io/sparkfabrik/docker-alpine-aws-cli:2.15.14-alpine3.18 as awscli +FROM ghcr.io/sparkfabrik/docker-alpine-aws-cli:2.15.42-alpine3.19 as awscli -FROM alpine:3.18 +FROM alpine:3.19 # Install AWS CLI v2 using the binary builded in the awscli stage COPY --from=awscli /usr/local/aws-cli/ /usr/local/aws-cli/ -RUN ln -s /usr/local/aws-cli/v2/current/bin/aws /usr/local/bin/aws +RUN ln -s /usr/local/aws-cli/v2/current/bin/aws /usr/local/bin/aws \ + && ln -s /usr/local/aws-cli/v2/current/bin/aws_completer /usr/local/bin/aws_completer ``` In the final image you can run the `aws` topics using the AWS CLI v2.