Build docker and publish docker image in CI

main
kalle 2024-03-23 12:59:02 +01:00
parent 631d7c9048
commit c61b6a3989
1 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,36 @@
name: Publish Docker image
on:
push:
branches:
- 'main'
jobs:
push_to_registry:
name: Push Docker image to local registry
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: setup buildx
uses: https://github.com/docker/setup-buildx-action@v2
- name: Log in to local registry
run: |
BASE64_AUTH=`echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64`
mkdir -p ~/.docker
echo "{\"auths\": {\"$CI_REGISTRY\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json
env:
CI_REGISTRY: https://git.kallestruik.nl
CI_REGISTRY_USER: ${{ secrets.FORGEJO_USERNAME }}
CI_REGISTRY_PASSWORD: ${{ secrets.FORGEJO_PASSWORD }}
- name: Build and push Docker image
uses: https://github.com/docker/build-push-action@v4
with:
context: .
push: true
tags: "git.kallestruik.nl/kalle/esl-docker:latest"