-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (40 loc) · 1.42 KB
/
dockerimage.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
name: Docker Build/Publish Image
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-20.04
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE: martijnversluis/home_app
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_TARGET_PLATFORM: linux/arm/v7
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
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 }} \
--tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \
--file ./Dockerfile \
--output type=image,push=true .