feat: enhance Docker workflow to support logging in and pushing images to Docker Hub; update README with new run command options
All checks were successful
Build and Push Docker Image / build (push) Successful in 4m11s

This commit is contained in:
2025-02-22 18:34:11 +01:00
parent 9e125bf9f7
commit bd80c1c6cc
2 changed files with 21 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ on:
env: env:
REGISTRY_URL: gitea.kobim.cloud REGISTRY_URL: gitea.kobim.cloud
DOCKERHUB_USERNAME: kobimex
jobs: jobs:
build: build:
@@ -18,14 +19,14 @@ jobs:
- name: Setup Docker Environment - name: Setup Docker Environment
uses: ./.github/actions/setup-docker-environment uses: ./.github/actions/setup-docker-environment
- name: Log in to Docker registry - name: Log in to custom Docker registry
uses: docker/login-action@v3.3.0 uses: docker/login-action@v3.3.0
with: with:
registry: ${{ env.REGISTRY_URL }} registry: ${{ env.REGISTRY_URL }}
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push Docker image - name: Build and push Docker image to custom registry
uses: docker/build-push-action@v6.13.0 uses: docker/build-push-action@v6.13.0
with: with:
context: . context: .
@@ -35,3 +36,20 @@ jobs:
platforms: | platforms: |
linux/amd64 linux/amd64
linux/arm64 linux/arm64
- name: Log in to Docker Hub
uses: docker/login-action@v3.3.0
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image to Docker Hub
uses: docker/build-push-action@v6.13.0
with:
context: .
push: true
tags: ${{ env.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}-monolith:latest
file: ./Monolith.dockerfile
platforms: |
linux/amd64
linux/arm64

View File

@@ -59,7 +59,7 @@ To stop the Docker containers run: `docker compose down -v`
3. Ajust the firewall settings to allow the necessary ports if needed 3. Ajust the firewall settings to allow the necessary ports if needed
4. Start the Docker container: 4. Start the Docker container:
```sh ```sh
docker run --rm -p 7900:7900 --env-file .env --name peertube-collector gitea.kobim.cloud/kobim/peertube-collector-monolith:latest docker run --rm -p 7900:7900 --env-file .env --name peertube-collector --pull always gitea.kobim.cloud/kobim/peertube-collector-monolith:latest
``` ```