Skip to content

Commit 702b9da

Browse files
committed
Add github actions to build multi arch images
1 parent 392b1c7 commit 702b9da

26 files changed

Lines changed: 525 additions & 59 deletions
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build consumerui
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
release:
8+
types: [published, edited]
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v3
17+
-
18+
name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
-
21+
name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
-
24+
name: Login to Container Registry
25+
uses: docker/login-action@v2
26+
if: github.event_name != 'pull_request'
27+
with:
28+
registry: ${{ secrets.REGISTRY }}
29+
username: ${{ secrets.REGISTRY_USERNAME }}
30+
password: ${{ secrets.REGISTRY_PASSWORD }}
31+
-
32+
name: Set Version
33+
run: echo "VERSION=$(tail -1 consumerui/versions.txt)" >> $GITHUB_ENV
34+
-
35+
name: Docker metadata
36+
id: consumerui_meta
37+
uses: docker/metadata-action@v4
38+
with:
39+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/consumerui
40+
tags: |
41+
type=raw,value=latest,enable={{is_default_branch}}
42+
type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
43+
44+
-
45+
name: Build and push consumerui
46+
uses: docker/build-push-action@v4
47+
with:
48+
context: ./consumerui
49+
platforms: linux/amd64,linux/arm64
50+
push: ${{ github.event_name != 'pull_request' }}
51+
tags: ${{ steps.consumerui_meta.outputs.tags }}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Build deploy utils
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
release:
8+
types: [published, edited]
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v3
17+
-
18+
name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
-
21+
name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
-
24+
name: Login to Container Registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: ${{ secrets.REGISTRY }}
28+
username: ${{ secrets.REGISTRY_USERNAME }}
29+
password: ${{ secrets.REGISTRY_PASSWORD }}
30+
-
31+
name: Set Version
32+
run: echo "VERSION=$(tail -1 deploy/versions.txt)" >> $GITHUB_ENV
33+
34+
-
35+
name: Docker webhook metadata
36+
id: webhook_tls_getter
37+
uses: docker/metadata-action@v4
38+
with:
39+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/webhook-tls-getter
40+
tags: |
41+
type=raw,value=latest,enable={{is_default_branch}}
42+
type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
43+
-
44+
name: Build and push webhook-tls-getter
45+
uses: docker/build-push-action@v4
46+
with:
47+
context: ./deploy
48+
file: ./deploy/Dockerfile
49+
platforms: linux/amd64,linux/arm64
50+
push: ${{ github.event_name != 'pull_request' }}
51+
tags: ${{ steps.webhook_tls_getter.outputs.tags }}
52+
53+
-
54+
name: Docker delete-kubeplus-resources metadata
55+
id: delete_kubeplus_resources
56+
uses: docker/metadata-action@v4
57+
with:
58+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/delete-kubeplus-resources
59+
tags: |
60+
type=raw,value=latest,enable={{is_default_branch}}
61+
type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
62+
63+
-
64+
name: Build and push delete-kubeplus-resources
65+
uses: docker/build-push-action@v4
66+
with:
67+
context: ./deploy
68+
file: ./deploy/Dockerfile.cleanup
69+
platforms: linux/amd64,linux/arm64
70+
push: ${{ github.event_name != 'pull_request' }}
71+
tags: ${{ steps.delete_kubeplus_resources.outputs.tags }}
72+
73+
-
74+
name: Docker kubeconfiggenerator metadata
75+
id: kubeconfiggenerator
76+
uses: docker/metadata-action@v4
77+
with:
78+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/kubeconfiggenerator
79+
tags: |
80+
type=raw,value=latest,enable={{is_default_branch}}
81+
type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
82+
83+
-
84+
name: Build and push kubeconfiggenerator
85+
uses: docker/build-push-action@v4
86+
with:
87+
context: ./deploy
88+
file: ./deploy/Dockerfile.kubeconfiggenerator
89+
platforms: linux/amd64,linux/arm64
90+
push: ${{ github.event_name != 'pull_request' }}
91+
tags: ${{ steps.kubeconfiggenerator.outputs.tags }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build mutating-webhook
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
release:
8+
types: [published, edited]
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v3
17+
-
18+
name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
-
21+
name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
-
24+
name: Login to Container Registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: ${{ secrets.REGISTRY }}
28+
username: ${{ secrets.REGISTRY_USERNAME }}
29+
password: ${{ secrets.REGISTRY_PASSWORD }}
30+
-
31+
name: Set Version
32+
run: echo "VERSION=$(tail -1 mutating-webhook/versions.txt)" >> $GITHUB_ENV
33+
-
34+
name: Docker webhook metadata
35+
id: pac_mutating_admission_webhook
36+
uses: docker/metadata-action@v4
37+
with:
38+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/pac-mutating-admission-webhook
39+
tags: |
40+
type=raw,value=latest,enable={{is_default_branch}}
41+
type=raw,value=${{env.VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
42+
43+
-
44+
name: Build and push mutating-webhook
45+
uses: docker/build-push-action@v4
46+
with:
47+
context: .
48+
file: mutating-webhook/Dockerfile
49+
platforms: linux/amd64,linux/arm64
50+
push: ${{ github.event_name != 'pull_request' }}
51+
tags: ${{ steps.pac_mutating_admission_webhook.outputs.tags }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build helmer
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
release:
8+
types: [published, edited]
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v3
17+
-
18+
name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
-
21+
name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
-
24+
name: Login to Container Registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: ${{ secrets.REGISTRY }}
28+
username: ${{ secrets.REGISTRY_USERNAME }}
29+
password: ${{ secrets.REGISTRY_PASSWORD }}
30+
-
31+
name: Set Helmer Version
32+
run: echo "HELMER_VERSION=$(tail -1 platform-operator/helm-pod/versions.txt)" >> $GITHUB_ENV
33+
34+
-
35+
name: Docker helm-pod metadata
36+
id: helm_pod
37+
uses: docker/metadata-action@v4
38+
with:
39+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/helm-pod
40+
tags: |
41+
type=raw,value=latest,enable={{is_default_branch}}
42+
type=raw,value=${{env.HELMER_VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
43+
44+
-
45+
name: Build and push helm pod
46+
uses: docker/build-push-action@v4
47+
with:
48+
context: .
49+
file: platform-operator/helm-pod/Dockerfile
50+
platforms: linux/amd64,linux/arm64
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: ${{ steps.helm_pod.outputs.tags }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build platform-operator
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
release:
8+
types: [published, edited]
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v3
17+
-
18+
name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
-
21+
name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
-
24+
name: Login to Container Registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: ${{ secrets.REGISTRY }}
28+
username: ${{ secrets.REGISTRY_USERNAME }}
29+
password: ${{ secrets.REGISTRY_PASSWORD }}
30+
31+
-
32+
name: Set platform-operator Version
33+
run: echo "OPERATOR_VERSION=$(tail -1 platform-operator/versions.txt)" >> $GITHUB_ENV
34+
-
35+
name: Docker platform-operator metadata
36+
id: platform_operator
37+
uses: docker/metadata-action@v4
38+
with:
39+
images: ${{ secrets.REGISTRY }}/${{ secrets.REGISTRY_USERNAME }}/platform-operator
40+
tags: |
41+
type=raw,value=latest,enable={{is_default_branch}}
42+
type=raw,value=${{env.OPERATOR_VERSION}},enable=${{ github.event_name == 'release' && github.event.action == 'published' }}
43+
44+
-
45+
name: Build and push platform-operator
46+
uses: docker/build-push-action@v4
47+
with:
48+
context: ./platform-operator
49+
file: platform-operator/artifacts/deployment/Dockerfile
50+
platforms: linux/amd64,linux/arm64
51+
push: ${{ github.event_name != 'pull_request' }}
52+
tags: ${{ steps.platform_operator.outputs.tags }}

consumerui/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ FROM ubuntu:20.04
22

33
RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && apt-get install -y python3-pip python-setuptools curl wget tar sudo apt-transport-https ca-certificates socat python-yaml vim graphviz
44

5-
RUN curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg && echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list && apt-get update -y && apt-get install -y kubectl && cp /usr/bin/python3.8 /usr/bin/python
5+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
6+
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl && \
7+
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
8+
cp /usr/bin/python3.8 /usr/bin/python
69

710
RUN wget https://github.com/cloud-ark/kubeplus/raw/master/kubeplus-kubectl-plugins.tar.gz && gunzip kubeplus-kubectl-plugins.tar.gz && tar -xvf kubeplus-kubectl-plugins.tar && cp -r /plugins/* bin/
811

consumerui/build-artifact.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fi
1313
if [ "$artifacttype" = "versioned" ]; then
1414
version=`tail -1 versions.txt`
1515
echo "Building version $version"
16-
docker build --no-cache -t gcr.io/cloudark-kubeplus/consumerui:$version .
16+
docker build --no-cache -t gcr.io/cloudark-kubeplus/consumerui:$version .
1717
docker push gcr.io/cloudark-kubeplus/consumerui:$version
1818
fi
1919

deploy/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM ubuntu:20.04
2-
RUN apt-get update && apt-get install -y openssl jq python3 python3-pip && pip3 install pyyaml
2+
RUN apt-get update && apt-get install -y openssl curl jq python3 python3-pip && pip3 install pyyaml
33
ADD webhook-create-self-signed-ca-cert.sh /
4-
COPY kubectl /root/
4+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl"
55
COPY kubeplus-non-pod-resources.yaml /root/.
66
COPY mutatingwebhook.yaml /root/.
77
#COPY webhook-patch-ca-bundle-new.sh /root/.

deploy/Dockerfile.cleanup

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22
ADD delete-kubeplus-components.sh /root/.
3-
COPY kubectl /root/
4-
RUN apt-get update && apt-get install -y openssl jq python3 python3-pip && pip3 install pyyaml
3+
RUN apt-get update && apt-get install -y openssl curl jq python3 python3-pip && pip3 install pyyaml
4+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl"
55
RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl
66
ENTRYPOINT ["/root/delete-kubeplus-components.sh"]

deploy/Dockerfile.kubeconfiggenerator

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
FROM ubuntu:20.04
2-
RUN apt-get update && apt-get install -y openssl jq python3 python3-pip wget && pip3 install pyyaml
3-
COPY kubectl /root/
4-
COPY helm /root/
2+
RUN apt-get update && apt-get install -y curl wget openssl jq python3 python3-pip && pip3 install pyyaml Flask
3+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
4+
wget "https://get.helm.sh/helm-v3.11.1-linux-${arch}.tar.gz" && \
5+
tar xvf "helm-v3.11.1-linux-${arch}.tar.gz" && \
6+
mv "linux-${arch}/helm" /root/ && rm "helm-v3.11.1-linux-${arch}.tar.gz" && \
7+
rm -rf "linux-${arch}"/
8+
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && cd /root/ && curl -LO "https://dl.k8s.io/release/v1.26.0/bin/linux/${arch}/kubectl"
59
COPY kubeconfiggenerator.py /root/.
6-
COPY kubeconfiggenerator.sh /root/.
7-
ADD requirements.txt /root/requirements.txt
8-
RUN cd /root; pip install -r requirements.txt
9-
RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl && chmod +x /root/kubeconfiggenerator.sh && cp /root/helm bin/. && chmod +x /root/helm && chmod +x bin/helm
10-
11-
#ENTRYPOINT ["/root/kubeconfiggenerator.sh"]
10+
RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl && cp /root/helm bin/. && chmod +x /root/helm && chmod +x bin/helm
1211

1312
EXPOSE 5005
1413
CMD ["python3", "/root/kubeconfiggenerator.py"]

0 commit comments

Comments
 (0)