File: docker.yaml

package info (click to toggle)
onedrive 2.5.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,252 kB
  • sloc: sh: 660; makefile: 167
file content (96 lines) | stat: -rw-r--r-- 2,944 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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@v4
        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@v3
        with:
          image: tonistiigi/binfmt:latest
          platforms: all
        if: matrix.platforms != 'linux/amd64'

      - uses: docker/setup-buildx-action@v3

      - name: Cache Docker layers
        uses: actions/cache@v4
        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@v3
        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@v6
        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