forked from secuvera/SpotMyBackup
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (38 loc) · 1.56 KB
/
Copy pathdockerimage.yml
File metadata and controls
38 lines (38 loc) · 1.56 KB
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
name: Docker Build/Publish Image
on:
# schedule:
# # * is a special character in YAML so you have to quote this string
# - cron: '30 5,17 * * *'
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: registry.hub.docker.com
DOCKER_IMAGE: briancarnold/spotmybackup
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_TARGET_PLATFORM: linux/arm64,linux/amd64
steps:
- name: Checkout the code
uses: actions/checkout@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Prepare
if: success()
id: prepare
run: |
echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM}
echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE}
echo ::set-output name=version::${GITHUB_RUN_NUMBER}
- name: Docker Login
if: success()
run: |
echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin
- name: Run Buildx (push image)
if: success()
run: |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} -t ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} -t ${{ steps.prepare.outputs.docker_image }}:latest . --push