Docker image build #1628
This file contains hidden or 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: [self-hosted] | |
| 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 | |
| # to build on top of lnd, or docker/v0.x.y-beta-litd-v0.aa.bb-alpha to | |
| # build on top of litd. Everything after the -lnd-/-litd- separator is the | |
| # base image version we build on top of; everything before it is lndinit's | |
| # version. The separator also selects the base image. | |
| - name: Set env for BASE_IMAGE, BASE_IMAGE_VERSION and LNDINIT_VERSION | |
| run: | | |
| if [[ "${RELEASE_VERSION}" == *-litd-* ]]; then | |
| echo "BASE_IMAGE=lightninglabs/lightning-terminal" >> $GITHUB_ENV | |
| echo "BASE_IMAGE_VERSION=${RELEASE_VERSION#*-litd-}" >> $GITHUB_ENV | |
| echo "LNDINIT_VERSION=${RELEASE_VERSION%%-litd-*}" >> $GITHUB_ENV | |
| else | |
| echo "BASE_IMAGE=lightninglabs/lnd" >> $GITHUB_ENV | |
| echo "BASE_IMAGE_VERSION=${RELEASE_VERSION##v*\.*\.*-beta-lnd-}" >> $GITHUB_ENV | |
| echo "LNDINIT_VERSION=${RELEASE_VERSION%%-lnd-v*\.*\.*-beta*}" >> $GITHUB_ENV | |
| fi | |
| - name: Set daily tag | |
| if: github.event.schedule == '0 1 * * *' | |
| run: | | |
| echo "BASE_IMAGE=lightninglabs/lnd" >> $GITHUB_ENV | |
| echo "BASE_IMAGE_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=${{ env.BASE_IMAGE }} | |
| BASE_IMAGE_VERSION=${{ env.BASE_IMAGE_VERSION }} | |
| - name: Image digest | |
| run: echo ${{ steps.docker_build.outputs.digest }} |