Update alpine Docker tag to v3.20.1 - autoclosed #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker Image | |
on: | |
push: | |
paths: | |
- Dockerfile | |
- .github/workflows/docker.yml | |
pull_request: | |
paths: | |
- Dockerfile | |
- .github/workflows/docker.yml | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Read version | |
id: version | |
run: echo "version=$(echo $(cat Dockerfile | grep -wE "ARG VALKEY_VERSION=*" | sed "s|ARG VALKEY_VERSION=||g"))" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 #all | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: env.BUILDKIT_STEP_LOG_MAX_SIZE=-1 | |
- name: Login to DockerHub | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Convert Username | |
id: un | |
run: echo "un=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ steps.un.outputs.un }} | |
password: ${{ github.token }} | |
- name: Build | |
uses: docker/build-push-action@v6 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 #,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 | |
push: ${{ github.ref == 'refs/heads/latest' }} | |
tags: | | |
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} | |
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }} | |
${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.version.outputs.version }} | |
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} | |
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.run_number }} | |
ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.version.outputs.version }} | |
- name: show version | |
if: ${{ github.ref == 'refs/heads/latest' }} | |
run: | | |
docker run --rm --entrypoint valkey-cli ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} --version | |
docker run --rm --entrypoint valkey-server ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} --version | |
docker run --rm --entrypoint valkey-cli ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} --version | |
docker run --rm --entrypoint valkey-server ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} --version | |
- name: copy valkey binary | |
if: ${{ github.ref == 'refs/heads/latest' }} | |
run: | | |
docker run -d --pull always --platform amd64 --name valkey-x86_64 ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} | |
docker cp valkey-x86_64:/usr/local/bin/valkey-server valkey-cli-x86_64 | |
docker cp valkey-x86_64:/usr/local/bin/valkey-server valkey-server-x86_64 | |
docker run -d --pull always --platform arm64 --name valkey-aarch64 ${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ github.ref_name }} | |
docker cp valkey-aarch64:/usr/local/bin/valkey-server valkey-cli-aarch64 | |
docker cp valkey-aarch64:/usr/local/bin/valkey-server valkey-server-aarch64 | |
- uses: actions/upload-artifact@v4 | |
if: ${{ github.ref == 'refs/heads/latest' }} | |
with: | |
name: artifacts | |
path: | | |
valkey-cli-x86_64 | |
valkey-server-x86_64 | |
valkey-cli-aarch64 | |
valkey-server-aarch64 | |
- uses: crowbarmaster/GH-Automatic-Releases@latest | |
if: ${{ github.ref == 'refs/heads/latest' }} | |
with: | |
prerelease: false | |
repo_token: ${{ github.token }} | |
title: valkey-${{ steps.version.outputs.version }} | |
automatic_release_tag: valkey-${{ steps.version.outputs.version }} | |
files: | | |
valkey-cli-x86_64 | |
valkey-server-x86_64 | |
valkey-cli-aarch64 | |
valkey-server-aarch64 | |
- name: Set PR-Number (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
id: pr | |
run: echo "pr=$(echo pr-${{ github.ref_name }} | sed "s|refs/pull/:||g" | sed "s|/merge||g")" >> $GITHUB_OUTPUT | |
- name: Build (PR) | |
uses: docker/build-push-action@v6 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 #,linux/amd64/v2,linux/amd64/v3,linux/amd64/v4,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 | |
push: ${{ github.event_name == 'pull_request' }} | |
tags: ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} | |
- name: show version (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
docker run --rm --entrypoint valkey-cli ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} --version | |
docker run --rm --entrypoint valkey-server ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} --version | |
- name: copy valkey binary (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
docker run -d --pull always --platform amd64 --name valkey-x86_64 ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} | |
docker cp valkey-x86_64:/usr/local/bin/valkey-server valkey-cli-x86_64 | |
docker cp valkey-x86_64:/usr/local/bin/valkey-server valkey-server-x86_64 | |
docker run -d --pull always --platform arm64 --name valkey-aarch64 ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }} | |
docker cp valkey-aarch64:/usr/local/bin/valkey-server valkey-cli-aarch64 | |
docker cp valkey-aarch64:/usr/local/bin/valkey-server valkey-server-aarch64 | |
- uses: actions/upload-artifact@v4 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
name: artifacts | |
path: | | |
valkey-cli-x86_64 | |
valkey-server-x86_64 | |
valkey-cli-aarch64 | |
valkey-server-aarch64 | |
- name: add comment (PR) | |
uses: mshick/add-pr-comment@v2 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
message: "The Docker Image can now be found here: `ghcr.io/${{ steps.un.outputs.un }}/${{ github.event.repository.name }}:${{ steps.pr.outputs.pr }}`" | |
repo-token: ${{ github.token }} | |