Docker #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Docker | |
on: # yamllint disable-line rule:truthy | |
# Schedule: Run at 00:00 AM UTC | |
schedule: | |
- cron: '00 00 * * *' | |
# Trigger on push to the main branch when the Dockerfile changes | |
push: | |
branches: | |
- main | |
paths: | |
- 'Dockerfile' | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: t4seame/app:latest | |
- name: Logout from Docker Hub | |
run: docker logout |