Skip to content

Commit 8e40e95

Browse files
committed
🚧 WIP: ci
1 parent 8044549 commit 8e40e95

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

.github/workflows/docker-image.yml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,49 @@
1-
name: Docker Image CI
1+
name: Docker CI/CD Pipeline
22

33
on:
44
push:
5-
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
5+
branches:
6+
- main
7+
- develop
8+
tags:
9+
- 'version-*'
10+
schedule:
11+
- cron: '0 0 1 * *'
12+
workflow_dispatch:
813

914
jobs:
10-
1115
build:
12-
1316
runs-on: ubuntu-latest
14-
17+
outputs:
18+
image: ${{ steps.docker_build.outputs.image }}
1519
steps:
16-
- uses: actions/checkout@v4
17-
- name: Build the Docker image
18-
run: docker build ./src/ --file ./src/Dockerfile --tag cloudflare-tunnel:$(date +%s)
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v2
25+
with:
26+
platforms: all
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v2
30+
31+
- name: Cache Docker layers
32+
uses: actions/cache@v2
33+
with:
34+
path: /tmp/.buildx-cache
35+
key: ${{ runner.os }}-buildx-${{ github.sha }}
36+
restore-keys: |
37+
${{ runner.os }}-buildx-
38+
39+
- name: Build Docker image
40+
id: docker_build
41+
uses: docker/build-push-action@v3
42+
with:
43+
context: .
44+
load: true
45+
outputs: type=docker
46+
tags: |
47+
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest
48+
${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/version-') && 'ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.ref_name }}' }}
49+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)