-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (34 loc) · 1.02 KB
/
docker-build-and-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 .