generated from swaglive/docker-IMAGE
-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (76 loc) · 2.47 KB
/
docker.yaml
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
name: Docker
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
PLATFORMS: linux/amd64,linux/arm64
strategy:
fail-fast: false
matrix:
version:
- ""
include:
- version: ""
latest: true
steps:
- name: Checkout
uses: actions/[email protected]
- name: Configure
id: config
run: |-
NPROC=$(nproc)
echo "NPROC=$((NPROC*2+1))" >> $GITHUB_ENV
echo "NPROC=$((NPROC*2+1))" >> $GITHUB_OUTPUT
echo "image-owner=${{ github.repository_owner }}" >> $GITHUB_OUTPUT
echo "image-name=${GITHUB_REPOSITORY#*/docker-}" >> $GITHUB_OUTPUT
- name: Setup - QEMU
id: qemu
uses: docker/[email protected]
with:
platforms: ${{ matrix.platforms || env.PLATFORMS || 'linux/amd64' }}
- name: Setup - Docker buildx
uses: docker/setup-buildx-action@v3
- name: Setup - Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup - Github Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Setup - Docker image metadata
id: meta
uses: docker/[email protected]
with:
images: |-
${{ steps.config.outputs.image-owner }}/${{ steps.config.outputs.image-name }}
ghcr.io/${{ steps.config.outputs.image-owner }}/${{ steps.config.outputs.image-name }}
flavor: |-
latest=${{ !!matrix.latest }}
tags: |-
type=raw,value=${{ matrix.version || 'latest' }},enabled=${{ !matrix.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ matrix.version }},enabled=${{ !!matrix.version }}
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=${{ matrix.version }},enabled=${{ !!matrix.version }}
- name: Build
uses: docker/[email protected]
id: build
with:
context: .
build-args: |
version=${{ matrix.version }}
push: true
platforms: ${{ matrix.platforms || env.PLATFORMS || 'linux/amd64' }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max