Skip to content

Commit 4930bb2

Browse files
authored
Add GitHub Actions workflow for Docker build and publish
1 parent 3581808 commit 4930bb2

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build & Publish Dockerhub + GHCR
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
# Dockerhub Login
20+
- name: Log in to Docker Hub
21+
uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
26+
# Login GitHub Container Registry (GHCR)
27+
- name: Log in to GHCR
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
# Extract Metadeta
35+
- name: Extract metadata for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: |
40+
pymmdrza/pyexplorer
41+
ghcr.io/${{ github.repository_owner }}/pyexplorer
42+
43+
# Push and Build
44+
- name: Build and push Docker image
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
push: true
49+
tags: |
50+
pymmdrza/pyexplorer:latest
51+
ghcr.io/${{ github.repository_owner }}/pyexplorer:latest
52+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)