forked from Red5d/docker-autocompose
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (68 loc) · 2.56 KB
/
docker.yml
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
name: Build Multi Stage Docker Image
on:
push:
branches-ignore:
- 'dependabot/**'
schedule:
- cron: '0 5 * * *'
jobs:
GHRC:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: FranzDiebold/[email protected]
- name: Print environment variables
run: |
echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME"
- name: Prepare GHRC.io
id: prep
run: |
REPO=$CI_REPOSITORY_NAME
OWNER="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
DOCKER_IMAGE=${OWNER}/${REPO}
if [ "$CI_REF_NAME" == "master" ];then VERSION=latest;fi
if [ "$CI_REF_NAME" == "dev" ];then VERSION=mightly;fi
if [ "$CI_REF_NAME" == "dockserver" ];then VERSION=dockserver;fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=title::${GITHUB_REPOSITORY}
echo ::set-output name=version::${VERSION}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: linux/amd64,linux/armhf,linux/arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]
- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push GHRC.io
id: docker_build
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/armhf,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.title=${{ steps.prep.outputs.title }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}