Skip to content

Commit

Permalink
GitHub: add workflow for building tagged docker images
Browse files Browse the repository at this point in the history
We add a GitHub workflow that is triggered whenever a new version tag is
pushed. It will trigger a docker image build for that version and
automatically push it to the specified repo.
  • Loading branch information
guggero committed Nov 17, 2020
1 parent 3f9a707 commit 9494ad6
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Docker image build

on:
push:
tags:
- 'v*'

defaults:
run:
shell: bash

env:
DOCKER_REPO: lightninglabs
DOCKER_IMAGE: lnd

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}"
build-args: checkout=${{ env.RELEASE_VERSION }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 9494ad6

Please sign in to comment.