Skip to content

Build and Push Docker Image #65

Build and Push Docker Image

Build and Push Docker Image #65

Workflow file for this run

name: Build and Push Docker Image
# Tento workflow se spustí při každém pushi do hlavní větve nebo dle plánovaného cron jobu
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # Spustí denní build každý den v 00:00 UTC
workflow_dispatch: # Umožní manuální spuštění z GitHub UI
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Build Docker Image
run: docker build -t massimofilippi/gitlab-runner .
- name: Push Docker Image to Docker Hub
run: docker push massimofilippi/gitlab-runner
# # Slack notifikace o úspěšném buildu
# - name: Notify Slack of build status
# if: success()
# run: |
# curl -X POST -H 'Content-type: application/json' --data '{"text":"Docker images build and push succeeded for all PHP versions!"}' ${{ secrets.SLACK_WEBHOOK_URL }}
#
# # Slack notifikace o neúspěšném buildu
# - name: Notify Slack of build failure
# if: failure()
# run: |
# curl -X POST -H 'Content-type: application/json' --data '{"text":"Docker images build or push failed for one or more PHP versions!"}' ${{ secrets.SLACK_WEBHOOK_URL }}