added docker-push.yaml workflow
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m14s
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m14s
This commit is contained in:
commit
41a8dc0db4
41
.gitea/workflows/docker-push.yaml
Normal file
41
.gitea/workflows/docker-push.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check if Dockerfile exists
|
||||
id: check_dockerfile
|
||||
run: |
|
||||
if [ -f "Dockerfile" ]; then
|
||||
echo "exists=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "exists=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Set repository name as image name
|
||||
if: env.exists == 'true'
|
||||
run: echo "IMAGE_NAME=${{ github.repository }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Log in to Docker registry
|
||||
if: env.exists == 'true'
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.ionas999.at -u ${{ secrets.REGISTRY_USERNAME }} --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
if: env.exists == 'true'
|
||||
run: |
|
||||
docker build -t git.ionas999.at/${{ env.IMAGE_NAME }}:latest .
|
||||
|
||||
- name: Push Docker image
|
||||
if: env.exists == 'true'
|
||||
run: |
|
||||
docker push git.ionas999.at/${{ env.IMAGE_NAME }}:latest
|
||||
Loading…
Reference in New Issue
Block a user