Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(upgrade): upgrade version of AWS CLI, python and alpine #15

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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 }}
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
41 changes: 19 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.