Skip to content

Commit 61e37f4

Browse files
committed
workflow: Docker build & push
1 parent 4fed673 commit 61e37f4

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/docker.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: 'Build & Push Docker Image'
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * 0" # Every Sunday
6+
workflow_dispatch:
7+
8+
env:
9+
CI: true
10+
DOCKER_BUILDKIT: 1
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Build Image
19+
run: |
20+
# Build Docker Image for DockerHub
21+
docker build --tag htrtech/zphisher:latest .
22+
23+
# Tag Docker Image for GHCR
24+
docker tag htrtech/zphisher:latest ghcr.io/htr-tech/zphisher:latest
25+
26+
- name: Login to GHCR
27+
if: github.repository == 'htr-tech/zphisher' && github.ref == 'refs/heads/master'
28+
uses: docker/login-action@v2
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Login to DockerHub
35+
if: github.repository == 'htr-tech/zphisher' && github.ref == 'refs/heads/master'
36+
uses: docker/login-action@v2
37+
with:
38+
username: "htrtech"
39+
password: ${{ secrets.DOCKER_TOKEN }}
40+
41+
- name: Push
42+
if: github.repository == 'htr-tech/zphisher' && github.ref == 'refs/heads/master'
43+
run: |
44+
# Push to DockerHub
45+
docker push htrtech/zphisher:latest
46+
# Push to GHCR
47+
docker push ghcr.io/htr-tech/zphisher:latest

0 commit comments

Comments
 (0)