Skip to content

buildx

buildx #313

Workflow file for this run

name: buildx
on:
workflow_dispatch:
schedule:
- cron: "0 21 * * 5"
push:
branches:
- 'master'
env:
DOCKERHUB_USER: wiserain
IMAGE_NAME: wiserain/flexget
ALPINE_VER: '3.19'
jobs:
buildx:
runs-on: ubuntu-22.04
if: github.event_name != 'pull_request'
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Compile requirements.txt
run: |
docker run --rm -i -v ${PWD}:/req alpine:${{ env.ALPINE_VER }} \
sh -c "apk add py3-pip build-base python3-dev libffi-dev && rm /usr/lib/python*/EXTERNALLY-MANAGED && pip install pip-tools && cd /req && pip-compile -U"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Buildx
uses: docker/setup-buildx-action@v3
-
name: Initial Buildx
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
tags: ${{ env.IMAGE_NAME }}:testing
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=${{ env.ALPINE_VER }}
-
name: Load Built Image and Get Variables
id: vars
run: |
docker buildx build \
-t ${{ env.IMAGE_NAME }}:testing \
--platform=linux/amd64 \
--build-arg ALPINE_VER=${{ env.ALPINE_VER }} \
--load \
.
CID=$(docker run -d ${{ env.IMAGE_NAME }}:testing)
VER_FULL=$(docker exec $CID flexget -V | sed -n 1p)
echo "VER_FULL=$VER_FULL" >> $GITHUB_ENV
docker rm -f $CID
VER_MINOR=$(echo $VER_FULL | cut -d. -f-2)
echo "VER_MINOR=$VER_MINOR" >> $GITHUB_ENV
VER_MAJOR=$(echo $VER_FULL | cut -d. -f-1)
echo "VER_MAJOR=$VER_MAJOR" >> $GITHUB_ENV
-
name: Login to docker.io
uses: docker/login-action@v3
with:
username: ${{ env.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
#
# release
#
-
name: Buildx and Push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ env.VER_FULL }}
${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }}
${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }}
ghcr.io/${{ env.IMAGE_NAME }}:latest
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_FULL }}
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }}
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }}
platforms: linux/amd64,linux/arm64
build-args: |
ALPINE_VER=${{ env.ALPINE_VER }}
push: true
-
name: Notification
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
description: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ env.VER_FULL }}
${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }}
${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }}
ghcr.io/${{ env.IMAGE_NAME }}:latest
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_FULL }}
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }}
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }}
-
name: Commit requirements.txt
uses: EndBug/add-and-commit@v9
with:
message: |
Update requirements.txt
- name: Upload Artifact
uses: actions/upload-artifact@v4
if: failure()
with:
name: requirements.txt
path: requirements.txt