-
Notifications
You must be signed in to change notification settings - Fork 70
62 lines (53 loc) · 1.83 KB
/
docker-image.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build and Publish Docker Image
# Trigger the workflow on push to the main branch or on manual dispatch
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# 2. Set up QEMU and Docker Buildx (for multi-platform builds, optional)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 3. Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: hykilpikonna
password: ${{ secrets.DOCKERHUB_TOKEN }}
# 3. Log in to GitHub Container Registry (ghcr.io)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
# Use GITHUB_TOKEN for authentication
password: ${{ secrets.GITHUB_TOKEN }}
# 4. Cache Docker layers to speed up builds (optional but recommended)
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# 5. Build and push the Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
hykilpikonna/aquadx:latest
ghcr.io/${{ github.repository_owner }}/AquaDX:latest
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache