Skip to content

Commit 61d6579

Browse files
authored
Build and push image locally, until github ci supports arm64.... (#28)
1 parent 0f77a18 commit 61d6579

2 files changed

Lines changed: 109 additions & 107 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Build and deploy
22
on:
3-
workflow_run:
4-
workflows: [Test and build]
5-
types:
6-
- completed
7-
branches:
8-
- master
3+
# workflow_run:
4+
# workflows: [Test and build]
5+
# types:
6+
# - completed
7+
# branches:
8+
# - master
99
workflow_dispatch:
1010
inputs:
1111
logLevel:
@@ -24,55 +24,56 @@ env:
2424
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
2525
REGISTRY_USER: ${{ github.actor }}
2626
jobs:
27-
build-amd64-and-upload:
28-
runs-on: ubuntu-latest
29-
steps:
30-
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v2
32-
- name: Login to GitHub Container Registry
33-
uses: docker/login-action@v2
34-
with:
35-
registry: ghcr.io
36-
# Can't use self-defined environment variables for some reason
37-
username: ${{ github.actor }}
38-
password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
39-
- name: Build and push image
40-
uses: docker/build-push-action@v4
41-
with:
42-
push: true
43-
target: release
44-
tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
45-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
46-
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
47-
platforms: linux/amd64
48-
build-arm64-and-upload:
49-
runs-on: ubuntu-latest
50-
steps:
51-
- name: Set up QEMU
52-
uses: docker/setup-qemu-action@v2
53-
with:
54-
platforms: arm64
55-
- name: Set up Docker Buildx
56-
uses: docker/setup-buildx-action@v2
57-
- name: Login to GitHub Container Registry
58-
uses: docker/login-action@v2
59-
with:
60-
registry: ghcr.io
61-
# Can't use self-defined environment variables for some reason
62-
username: ${{ github.actor }}
63-
password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
64-
- name: Build and push image
65-
uses: docker/build-push-action@v4
66-
with:
67-
push: true
68-
target: release
69-
tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
70-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
71-
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
72-
platforms: linux/arm64
27+
# TODO: Build and push multi-arch docker image locally, github ci supports arm64 or a better solution is found
28+
# build-amd64-and-upload:
29+
# runs-on: ubuntu-latest
30+
# steps:
31+
# - name: Set up Docker Buildx
32+
# uses: docker/setup-buildx-action@v2
33+
# - name: Login to GitHub Container Registry
34+
# uses: docker/login-action@v2
35+
# with:
36+
# registry: ghcr.io
37+
# # Can't use self-defined environment variables for some reason
38+
# username: ${{ github.actor }}
39+
# password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
40+
# - name: Build and push image
41+
# uses: docker/build-push-action@v4
42+
# with:
43+
# push: true
44+
# target: release
45+
# tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
46+
# cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
47+
# cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
48+
# platforms: linux/amd64
49+
# build-arm64-and-upload:
50+
# runs-on: ubuntu-latest
51+
# steps:
52+
# - name: Set up QEMU
53+
# uses: docker/setup-qemu-action@v2
54+
# with:
55+
# platforms: arm64
56+
# - name: Set up Docker Buildx
57+
# uses: docker/setup-buildx-action@v2
58+
# - name: Login to GitHub Container Registry
59+
# uses: docker/login-action@v2
60+
# with:
61+
# registry: ghcr.io
62+
# # Can't use self-defined environment variables for some reason
63+
# username: ${{ github.actor }}
64+
# password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
65+
# - name: Build and push image
66+
# uses: docker/build-push-action@v4
67+
# with:
68+
# push: true
69+
# target: release
70+
# tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
71+
# cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
72+
# cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
73+
# platforms: linux/arm64
7374
health_check:
7475
runs-on: ubuntu-latest
75-
needs: [build-amd64-and-upload, build-arm64-and-upload]
76+
# needs: [build-amd64-and-upload, build-arm64-and-upload]
7677
steps:
7778
- name: Check whether URL shortener is up
7879
id: health_check

.github/workflows/test.yml

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -28,62 +28,63 @@ jobs:
2828
./docker-compose.sh test build
2929
./docker-compose.sh test up --exit-code-from backend
3030
./docker-compose.sh test down
31-
build-amd64:
32-
runs-on: ubuntu-latest
33-
needs: [test]
34-
steps:
35-
- name: Set up Docker Buildx
36-
uses: docker/setup-buildx-action@v2
37-
- name: Login to GitHub Container Registry
38-
uses: docker/login-action@v2
39-
with:
40-
registry: ghcr.io
41-
# Can't use self-defined environment variables for some reason
42-
username: ${{ github.actor }}
43-
password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
44-
- name: Build image
45-
id: build_image
46-
uses: docker/build-push-action@v4
47-
with:
48-
push: false
49-
target: release
50-
tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
51-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
52-
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
53-
platforms: linux/amd64
54-
build-arm64:
55-
runs-on: ubuntu-latest
56-
needs: [test]
57-
steps:
58-
- name: Set up QEMU
59-
# npm install takes a very long time for arm64
60-
# https://github.com/docker/setup-qemu-action/issues/22
61-
# https://github.com/nodejs/docker-node/issues/1335
62-
uses: docker/setup-qemu-action@v2
63-
with:
64-
platforms: arm64
65-
- name: Set up Docker Buildx
66-
uses: docker/setup-buildx-action@v2
67-
- name: Login to GitHub Container Registry
68-
uses: docker/login-action@v2
69-
with:
70-
registry: ghcr.io
71-
# Can't use self-defined environment variables for some reason
72-
username: ${{ github.actor }}
73-
password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
74-
- name: Build image
75-
id: build_image
76-
uses: docker/build-push-action@v4
77-
with:
78-
push: false
79-
target: release
80-
tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
81-
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
82-
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
83-
platforms: linux/arm64
31+
# TODO: Build and push multi-arch docker image locally, github ci supports arm64 or a better solution is found
32+
# build-amd64:
33+
# runs-on: ubuntu-latest
34+
# needs: [test]
35+
# steps:
36+
# - name: Set up Docker Buildx
37+
# uses: docker/setup-buildx-action@v2
38+
# - name: Login to GitHub Container Registry
39+
# uses: docker/login-action@v2
40+
# with:
41+
# registry: ghcr.io
42+
# # Can't use self-defined environment variables for some reason
43+
# username: ${{ github.actor }}
44+
# password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
45+
# - name: Build image
46+
# id: build_image
47+
# uses: docker/build-push-action@v4
48+
# with:
49+
# push: false
50+
# target: release
51+
# tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
52+
# cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
53+
# cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
54+
# platforms: linux/amd64
55+
# build-arm64:
56+
# runs-on: ubuntu-latest
57+
# needs: [test]
58+
# steps:
59+
# - name: Set up QEMU
60+
# # npm install takes a very long time for arm64
61+
# # https://github.com/docker/setup-qemu-action/issues/22
62+
# # https://github.com/nodejs/docker-node/issues/1335
63+
# uses: docker/setup-qemu-action@v2
64+
# with:
65+
# platforms: arm64
66+
# - name: Set up Docker Buildx
67+
# uses: docker/setup-buildx-action@v2
68+
# - name: Login to GitHub Container Registry
69+
# uses: docker/login-action@v2
70+
# with:
71+
# registry: ghcr.io
72+
# # Can't use self-defined environment variables for some reason
73+
# username: ${{ github.actor }}
74+
# password: ${{ secrets.DOCKER_BUILD_PUSH_TOKEN }}
75+
# - name: Build image
76+
# id: build_image
77+
# uses: docker/build-push-action@v4
78+
# with:
79+
# push: false
80+
# target: release
81+
# tags: ghcr.io/${{ github.repository_owner }}/url_shortener:${{ github.sha }}
82+
# cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache
83+
# cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/url_shortener:buildcache,mode=max
84+
# platforms: linux/arm64
8485
notify_unsuccessful:
8586
runs-on: ubuntu-latest
86-
needs: [test, build-amd64, build-arm64]
87+
needs: [test]
8788
if: ${{ failure() }}
8889
env:
8990
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)