-
-
Notifications
You must be signed in to change notification settings - Fork 9
84 lines (73 loc) · 2.78 KB
/
dockerx-latest.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
78
79
80
81
82
83
84
name: Docker Image
on:
push:
branches:
- master
tags:
- "*.*.*"
jobs:
buildx:
runs-on: ubuntu-latest
#strategy:
# fail-fast: false
# max-parallel: 2
# matrix:
# # Not all for time waste reasons
# platform: [ "linux/arm64", "linux/amd64" ]
steps:
- name: Checkout
uses: actions/checkout@v4
# this writes the tag name into GIT_TAG_NAME
- name: Get tag name
uses: little-core-labs/[email protected]
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
#with:
# install: true
- name: Cache Docker layers
uses: actions/cache@v4
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=markusressel/barcode-server
# compare with support in base image: https://hub.docker.com/_/python
# orjson only supports 64bit variants, see: https://github.com/ijl/orjson
DOCKER_PLATFORMS=linux/amd64,linux/arm64
VERSION=latest
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
if [[ $GIT_TAG_NAME =~ ^v?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
VERSION=${GIT_TAG_NAME}
TAGS="$TAGS --tag ${DOCKER_IMAGE}:${VERSION}"
fi
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
--build-arg VERSION=${VERSION} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
${TAGS} --file Dockerfile .
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build
run: |
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}