Skip to content

Build and Push Docker Image #66

Build and Push Docker Image

Build and Push Docker Image #66

name: Build and Push Docker Image
on:
push:
branches:
- main
# Schedule for automatic builds
schedule:
- cron: '0 0 * * *' # Every day at midnight UTC
workflow_dispatch: # Allow manual triggers
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: |
/tmp/.buildx-cache
/tmp/.buildkit
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and push Docker image
run: |
docker buildx build --push --tag hanisntsolo/codeforces-lamp:latest .