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

Upgrade AWS CLI version to 2.15.14 #12

Merged
merged 1 commit into from
Jan 26, 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
130 changes: 68 additions & 62 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,107 @@
name: Docker

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
push:
branches: main

env:
RELEASE_BRANCH: main
REGISTRY: ghcr.io
IMAGE_NAME: docker-alpine-aws-cli
PLATFORM: "linux/amd64,linux/arm64"
PLATFORMS: "linux/amd64,linux/arm64"

jobs:
test-multiarch:
test:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
strategy:
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.13.18-3.18
- 2.13.18-3.17
- 2.13.18-3.16
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) }}
type=sha,format=long,prefix=

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Only build the images
- name: Get variables
id: vars
run: |
AWS_CLI_VERSION="$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')"
ALPINE_VERSION="$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')"
AUTHOR=$(echo "${{ github.repository_owner }}" | tr '[A-Z]' '[a-z]')
# Build process
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:${AWS_CLI_VERSION}-alpine${ALPINE_VERSION}
# Change all uppercase to lowercase.
IMAGE_ID=$(echo "${IMAGE_ID}" | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID=${IMAGE_ID}"
docker buildx build . \
--platform "${PLATFORM}" \
--build-arg AUTHOR=${AUTHOR} \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg AWS_CLI_VERSION=${AWS_CLI_VERSION} \
-t ${IMAGE_ID}
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"

deploy-multiarch:
- name: Build Docker image
uses: docker/build-push-action@v5
with:
load: true
push: false
context: .
build-args: |
AWS_CLI_VERSION=${{ steps.vars.outputs.aws_cli_version }}
ALPINE_VERSION=${{ steps.vars.outputs.alpine_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
if: contains('["refs/heads/main", "refs/heads/master"]', github.ref)
strategy:
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.13.18-3.18
- 2.13.18-3.17
- 2.13.18-3.16
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Refs https://github.com/docker/login-action#github-container-registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.RELEASE_BRANCH) }}
type=sha,format=long,prefix=

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Build and push images to GitHub Container Registry
- name: Get variables
id: vars
run: |
AWS_CLI_VERSION="$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[1]}')"
ALPINE_VERSION="$(echo "${{ matrix.tag }}" | awk '{split($0,a,"-"); print a[2]}')"
AUTHOR=$(echo "${{ github.repository_owner }}" | tr '[A-Z]' '[a-z]')
# Build process
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:${AWS_CLI_VERSION}-alpine${ALPINE_VERSION}
# Change all uppercase to lowercase.
IMAGE_ID=$(echo "${IMAGE_ID}" | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID=${IMAGE_ID}"
docker buildx build --push . \
--platform "${PLATFORM}" \
--build-arg AUTHOR=${AUTHOR} \
--build-arg IMAGE_NAME=${IMAGE_NAME} \
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg AWS_CLI_VERSION=${AWS_CLI_VERSION} \
-t ${IMAGE_ID}
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"

- name: Build Docker image
uses: docker/build-push-action@v5
with:
push: true
platforms: ${{ env.PLATFORMS }}
context: .
build-args: |
AWS_CLI_VERSION=${{ steps.vars.outputs.aws_cli_version }}
ALPINE_VERSION=${{ steps.vars.outputs.alpine_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM python:3.10.11-alpine${ALPINE_VERSION} as builder
ARG AUTHOR
ARG ALPINE_VERSION=3.18
ARG IMAGE_NAME=spark-alpine-aws-cli
ARG AWS_CLI_VERSION=2.15.0
ARG AWS_CLI_VERSION=2.15.14

# Build process
RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
Expand All @@ -24,7 +24,6 @@ RUN find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.jso
RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete

FROM alpine:${ALPINE_VERSION}
LABEL org.opencontainers.image.source https://github.com/${AUTHOR}/${IMAGE_NAME}

RUN apk add --no-cache groff

Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ AUTHOR ?= sparkfabrik
IMAGE_NAME ?= docker-alpine-aws-cli
PLATFORM ?= "linux/amd64"

build: build-2.15.0-3.18
build: build-2.15.14-3.18

# 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.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.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
Expand All @@ -17,18 +29,6 @@ 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.13.18-3.18: AWS_CLI_VERSION="2.13.18"
build-2.13.18-3.18: ALPINE_VERSION="3.18"
build-2.13.18-3.18: build-template

build-2.13.18-3.17: AWS_CLI_VERSION="2.13.18"
build-2.13.18-3.17: ALPINE_VERSION="3.17"
build-2.13.18-3.17: build-template

build-2.13.18-3.16: AWS_CLI_VERSION="2.13.18"
build-2.13.18-3.16: ALPINE_VERSION="3.16"
build-2.13.18-3.16: build-template

build-template:
docker buildx build --load . \
--platform "$(PLATFORM)" \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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.0-alpine3.18 as awscli
FROM ghcr.io/sparkfabrik/docker-alpine-aws-cli:2.15.14-alpine3.18 as awscli

FROM alpine:3.18
# Install AWS CLI v2 using the binary builded in the awscli stage
Expand Down