diff options
author | thursday <xthursdayx@mailbox.org> | 2021-11-17 18:30:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 05:00:57 +0530 |
commit | a789196f539e56035b6c62b577cdfc7bd5f60eff (patch) | |
tree | 0da1148428f8720acc218ade0f67eaa0ffff4e98 /.github | |
parent | Update README.md (diff) | |
download | ferdium-server-a789196f539e56035b6c62b577cdfc7bd5f60eff.tar.gz ferdium-server-a789196f539e56035b6c62b577cdfc7bd5f60eff.tar.zst ferdium-server-a789196f539e56035b6c62b577cdfc7bd5f60eff.zip |
Adding updated Docker image build workflow (#83)
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build-and-publish.yml | 63 | ||||
-rw-r--r-- | .github/workflows/main.yml | 18 |
2 files changed, 63 insertions, 18 deletions
diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..bd24f9c --- /dev/null +++ b/.github/workflows/build-and-publish.yml | |||
@@ -0,0 +1,63 @@ | |||
1 | name: Build and Publish Docker Image | ||
2 | |||
3 | on: | ||
4 | push: | ||
5 | tags: | ||
6 | - 'v*.*.*' | ||
7 | release: | ||
8 | types: [published] | ||
9 | workflow_dispatch: | ||
10 | |||
11 | jobs: | ||
12 | image-build: | ||
13 | runs-on: ubuntu-latest | ||
14 | steps: | ||
15 | - name: Checkout | ||
16 | uses: actions/checkout@v2 | ||
17 | |||
18 | - name: Docker meta | ||
19 | id: meta | ||
20 | uses: docker/metadata-action@v3 | ||
21 | with: | ||
22 | images: | | ||
23 | getferdi/ferdi-server | ||
24 | # ghcr.io/getferdi/ferdi-server | ||
25 | tags: | | ||
26 | type=ref,event=branch | ||
27 | type=ref,event=pr | ||
28 | type=semver,pattern={{version}} | ||
29 | type=semver,pattern={{major}}.{{minor}} | ||
30 | type=semver,pattern={{major}} | ||
31 | |||
32 | - name: Set up QEMU | ||
33 | uses: docker/setup-qemu-action@v1 | ||
34 | |||
35 | - name: Set up Docker Buildx | ||
36 | uses: docker/setup-buildx-action@v1 | ||
37 | |||
38 | - name: Login to DockerHub | ||
39 | uses: docker/login-action@v1 | ||
40 | with: | ||
41 | username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
42 | password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
43 | |||
44 | - name: Login to GitHub Container Registry | ||
45 | uses: docker/login-action@v1 | ||
46 | with: | ||
47 | registry: ghcr.io | ||
48 | username: ${{ github.repository_owner }} | ||
49 | password: ${{ secrets.GITHUB_TOKEN }} | ||
50 | |||
51 | - name: Build and push | ||
52 | id: docker_build | ||
53 | uses: docker/build-push-action@v2 | ||
54 | with: | ||
55 | context: . | ||
56 | file: ./Dockerfile | ||
57 | platforms: linux/amd64,linux/arm64 | ||
58 | push: true | ||
59 | tags: ${{ steps.meta.outputs.tags }}, getferdi/ferdi-server:latest | ||
60 | labels: ${{ steps.meta.outputs.labels }} | ||
61 | |||
62 | - name: Image digest | ||
63 | run: echo ${{ steps.docker_build.outputs.digest }} | ||
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index e21943b..0000000 --- a/.github/workflows/main.yml +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | name: Trigger Docker Hub build | ||
2 | |||
3 | on: | ||
4 | release: | ||
5 | types: [published] | ||
6 | |||
7 | jobs: | ||
8 | build: | ||
9 | |||
10 | runs-on: ubuntu-latest | ||
11 | |||
12 | steps: | ||
13 | - name: Install HTTPie | ||
14 | run: sudo apt-get install httpie | ||
15 | |||
16 | - name: Send request to Docker Hub to trigger a build | ||
17 | run: > | ||
18 | http post https://hub.docker.com/api/build/v1/source/83564f19-c21a-4dae-9690-971aee3b2a3b/trigger/${{ env.HUB_TRIGGER_ID }}/call/' | ||