Skip to content

Build and Publish Docker image(s) #145

Build and Publish Docker image(s)

Build and Publish Docker image(s) #145

Workflow file for this run

name: Build and Publish Docker image(s)
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Update Lume versiob to latest
run: bash update.sh
- name: Retrieve Lume version from Dockerfile manifest
id: lume_version
run: echo ::set-output name=docker_tag::$(grep -m1 "ARG LUME_VERSION=" ./${{ matrix.distro }}/Dockerfile | cut -d "=" -f2 | tr -d '"')
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build and push default Docker image
if: matrix.distro == 'alpine'
uses: docker/build-push-action@v4
with:
context: ./${{ matrix.distro }}/
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
build-args: |
"GITHUB_SHA=${GITHUB_SHA}"
"GITHUB_REF=${GITHUB_REF}"
"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./${{ matrix.distro }}/
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.lume_version.outputs.docker_tag }}-${{ matrix.distro }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.distro }}
build-args: |
"GITHUB_SHA=${GITHUB_SHA}"
"GITHUB_REF=${GITHUB_REF}"
"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
- name: remove untagged docker containers
uses: camargo/delete-untagged-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
distro:
- alpine
- debian
on:
schedule:
- cron: '0 12 * * */6'
push:
branches:
- main