mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-29 10:50:30 +02:00
86b4cd3452
* Restore i386 build using Debian 12 * Tested on i386 and x86_64 * ARM64 and ARMHF not yet tested / validated
97 lines
2.9 KiB
YAML
97 lines
2.9 KiB
YAML
name: Build Docker Images
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
# Comment these out to force a test build on a PR
|
|
branches:
|
|
- master
|
|
types: [closed]
|
|
|
|
env:
|
|
DOCKER_HUB_SLUG: driveone/onedrive
|
|
|
|
jobs:
|
|
build:
|
|
# Comment this out to force a test build on a PR
|
|
if: (!(github.event.action == 'closed' && github.event.pull_request.merged != true))
|
|
|
|
# Build runs on
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
flavor: [ fedora, debian, alpine ]
|
|
include:
|
|
- flavor: fedora
|
|
dockerfile: ./contrib/docker/Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
- flavor: debian
|
|
dockerfile: ./contrib/docker/Dockerfile-debian
|
|
platforms: linux/386,linux/amd64,linux/arm64,linux/arm/v7
|
|
- flavor: alpine
|
|
dockerfile: ./contrib/docker/Dockerfile-alpine
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
steps:
|
|
- name: Check out code from GitHub
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: marcelcoding/ghaction-docker-meta@v2
|
|
with:
|
|
tag-edge: true
|
|
images: |
|
|
${{ env.DOCKER_HUB_SLUG }}
|
|
tag-semver: |
|
|
{{version}}
|
|
{{major}}.{{minor}}
|
|
flavor: ${{ matrix.flavor }}
|
|
main-flavor: ${{ matrix.flavor == 'debian' }}
|
|
|
|
- uses: docker/setup-qemu-action@v2
|
|
with:
|
|
image: tonistiigi/binfmt:latest
|
|
platforms: all
|
|
if: matrix.platforms != 'linux/amd64'
|
|
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ matrix.flavor }}-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-${{ matrix.flavor }}
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2
|
|
if: github.event_name != 'pull_request'
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
- name: Build and Push to Docker
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
file: ${{ matrix.dockerfile }}
|
|
platforms: ${{ matrix.platforms }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
|
|
|
- name: Move cache
|
|
run: |
|
|
rm -rf /tmp/.buildx-cache
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|