Docker image build #931
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker image build | |
on: | |
push: | |
tags: | |
- 'docker/v*' | |
schedule: | |
# Every day at 1AM (UTC). | |
- cron: '0 1 * * *' | |
defaults: | |
run: | |
shell: bash | |
env: | |
DOCKER_REPO: lightninglabs | |
DOCKER_IMAGE: lndinit | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: lightninglabs/gh-actions/setup-qemu-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4 | |
- name: Set up Docker Buildx | |
uses: lightninglabs/gh-actions/setup-buildx-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4 | |
- name: Login to DockerHub | |
uses: lightninglabs/gh-actions/login-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_API_KEY }} | |
- name: Set env for RELEASE_VERSION | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/docker/}" >> $GITHUB_ENV | |
# We will push tags with the format docker/v0.x.y-beta-lnd-v0.aa.bb-beta | |
# where x and y are lndinit's version and aa and bb are lnd's version. | |
# This variable LND_VERSION extracts everything after v0.x.y-lnd- so we | |
# know which base image we need to build on top of. | |
- name: Set env for LND_VERSION | |
run: echo "LND_VERSION=${RELEASE_VERSION##v*\.*\.*-beta-lnd-}" >> $GITHUB_ENV | |
- name: Set env for LNDINIT_VERSION | |
run: echo "LNDINIT_VERSION=${RELEASE_VERSION%%-lnd-v*\.*\.*-beta*}" >> $GITHUB_ENV | |
- name: Set daily tag | |
if: github.event.schedule == '0 1 * * *' | |
run: | | |
echo "LND_VERSION=daily-testing-only" >> $GITHUB_ENV | |
echo "LNDINIT_VERSION=main" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=daily-testing-$(date -u +%Y%m%d),${DOCKER_REPO}/${DOCKER_IMAGE}:daily-testing-only" >> $GITHUB_ENV | |
- name: Build and push | |
id: docker_build | |
uses: lightninglabs/gh-actions/build-push-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}" | |
build-args: | | |
checkout=${{ env.LNDINIT_VERSION }} | |
BASE_IMAGE_VERSION=${{ env.LND_VERSION }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |