Docker #9
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: Docker | |
on: | |
workflow_dispatch: | |
permissions: | |
packages: write | |
jobs: | |
docker-build: | |
name: Docker | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: download binaries | |
uses: robinraju/[email protected] | |
id: dl | |
with: | |
latest: true | |
tarBall: true | |
zipBall: false | |
- name: extract binaries | |
run: | | |
tar -xzvf awsbck-v*-linux-x64.tar.gz && mkdir linux_amd64 && mv awsbck linux_amd64/awsbck | |
tar -xzvf awsbck-v*-linux-aarch64.tar.gz && mkdir linux_arm64 && mv awsbck linux_arm64/awsbck | |
tar -xzvf awsbck-v*-linux-armv7.tar.gz && mkdir linux_arm && mv awsbck linux_arm/awsbck | |
- name: semver | |
id: semver | |
run: | | |
VERSION=$(echo "${{steps.dl.outputs.tag_name}}" | sed -e 's/^v//') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
MAJOR=`echo $VERSION | cut -d. -f1` | |
echo "major=$MAJOR" >> $GITHUB_OUTPUT | |
MINOR=`echo $VERSION | cut -d. -f2` | |
echo "minor=$MINOR" >> $GITHUB_OUTPUT | |
REVISION=`echo $REVISION | cut -d. -f3` | |
echo "revision=$REVISION" >> $GITHUB_OUTPUT | |
- name: Login to Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker metadata root | |
id: meta-root | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/awsbck | |
flavor: | | |
latest=false | |
tags: | | |
type=raw,value=root-${{steps.semver.outputs.major}},enable=${{ steps.semver.outputs.major != '0' }} | |
type=raw,value=root-${{steps.semver.outputs.major}}.${{steps.semver.outputs.minor}} | |
type=raw,value=root-${{steps.semver.outputs.version}} | |
type=raw,value=root-latest | |
- name: Build and push root | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: . | |
file: Dockerfile.root | |
tags: ${{ steps.meta-root.outputs.tags }} | |
labels: ${{ steps.meta-root.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/awsbck | |
flavor: | | |
latest=true | |
tags: | | |
type=raw,value=${{steps.semver.outputs.major}},enable=${{ steps.semver.outputs.major != '0' }} | |
type=raw,value=${{steps.semver.outputs.major}}.${{steps.semver.outputs.minor}} | |
type=raw,value=${{steps.semver.outputs.version}} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 |