63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: Build on push
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v[0-9]+.[0-9]+.[0-9]+
|
|
- v[0-9]+.[0-9]+.[0-9]+-*
|
|
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
|
|
jobs:
|
|
build:
|
|
name: Build image
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- linux/amd64
|
|
- linux/arm64
|
|
steps:
|
|
- name: Checkout project
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set env variables
|
|
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
id: qemu
|
|
|
|
- name: Setup Docker buildx action
|
|
uses: docker/setup-buildx-action@v1
|
|
id: buildx
|
|
|
|
- name: Show available Docker buildx platforms
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
|
|
|
|
- name: Run Docker buildx
|
|
run: |
|
|
docker buildx build \
|
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
|
--platform ${{matrix.platform}} \
|
|
--tag ${{ secrets.DOCKER_CONTAINER_USERNAME }}/lndhub:$TAG \
|
|
--output "type=registry" ./
|
|
- name: Run Docker buildx
|
|
run: |
|
|
docker buildx build \
|
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
|
--platform ${{matrix.platform}} \
|
|
--tag ${{ secrets.DOCKER_CONTAINER_USERNAME }}/lndhub:latest \
|
|
--output "type=registry" ./
|