Docker image build #405
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: | |
- 'v*' | |
schedule: | |
# Every day at midnight (UTC). | |
- cron: '0 0 * * *' | |
# Manual trigger through the UI for testing. | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
env: | |
DOCKER_ORG: lightninglabs | |
DOCKER_REPO: lightning-terminal | |
NIGHTLY_DOCKER_REPO: lightning-terminal-nightly | |
NIGHTLY_BRANCH_NAME: master | |
NIGHTLY_TAG_NAME: experimental-daily-testing | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: cleanup space | |
run: rm -rf /opt/hostedtoolcache | |
- name: Set up QEMU | |
uses: lightninglabs/gh-actions/[email protected] | |
- name: Set up Docker Buildx | |
uses: lightninglabs/gh-actions/[email protected] | |
- name: Login to DockerHub | |
uses: lightninglabs/gh-actions/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_API_KEY }} | |
# Make it possible to use different values for the version (used for git | |
# checkout) and the image tag (used for the docker image tag). | |
- name: Set env | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
# The daily/nightly build (or manual trigger) will always use the | |
# experimental branch and push to a different docker repo. | |
- name: Set daily tag | |
if: ${{ github.event.schedule == '0 0 * * *' || github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "RELEASE_VERSION=${{env.NIGHTLY_BRANCH_NAME}}" >> $GITHUB_ENV | |
echo "DOCKER_REPO=${{env.NIGHTLY_DOCKER_REPO}}" >> $GITHUB_ENV | |
echo "IMAGE_TAG=${{env.NIGHTLY_TAG_NAME}}-$(date -u +%Y%m%d)" >> $GITHUB_ENV | |
- name: Build and push default image | |
id: docker_build | |
uses: lightninglabs/gh-actions/[email protected] | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}" | |
build-args: checkout=${{ env.RELEASE_VERSION }} | |
- name: Clear the Docker build cache | |
run: docker builder prune -a -f | |
- name: Clear the Docker image cache | |
run: docker image prune -a -f | |
- name: Build and push image with /lit path | |
id: docker_build2 | |
uses: lightninglabs/gh-actions/[email protected] | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: "${{ env.DOCKER_ORG }}/${{ env.DOCKER_REPO }}:${{ env.IMAGE_TAG }}-path-prefix" | |
build-args: | | |
checkout=${{ env.RELEASE_VERSION }} | |
public_url=/lit | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} ${{ steps.docker_build2.outputs.digest }} |