-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (70 loc) · 2.59 KB
/
docker-build.yml
File metadata and controls
80 lines (70 loc) · 2.59 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build and Push Docker Image
# =============================================================================
# MANUAL TRIGGER ONLY (workflow_dispatch)
# =============================================================================
# This workflow builds and pushes the Docker container to GHCR and Docker Hub.
# It is ONLY triggered manually by the instructor to prevent students from
# seeing confusing "permission denied" errors when they push to their repos.
#
# HOW TO TRIGGER A NEW BUILD:
# 1. Go to GitHub repo → Actions tab
# 2. Click "Build and Push Docker Image" in the left sidebar
# 3. Click "Run workflow" button (top right)
# 4. Select 'main' branch → Click "Run workflow"
#
# The build takes ~2-3 minutes and pushes to:
# - ghcr.io/cosmelab/dna-barcoding-analysis:latest
# - docker.io/cosmelab/dna-barcoding-analysis:latest
# =============================================================================
on:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'cosmelab/dna-barcoding-analysis'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
buildkitd-flags: --debug
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/cosmelab/dna-barcoding-analysis
docker.io/cosmelab/dna-barcoding-analysis
tags: |
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./container/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max