Skip to content

Commit 2dc15ff

Browse files
committed
Split container build
Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent 0dcd5b2 commit 2dc15ff

File tree

2 files changed

+118
-3
lines changed

2 files changed

+118
-3
lines changed

.github/workflows/containers.yml

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
deploy:
2222
if: github.repository_owner == 'appthreat'
2323
runs-on: ubuntu-24.04
24+
outputs:
25+
image-uri: ghcr.io/appthreat/chen@${{ steps.build.outputs.digest }}
2426
permissions:
2527
contents: write
2628
packages: write
@@ -96,7 +98,8 @@ jobs:
9698
chmod +x nydus-static/*
9799
mv nydus-static/* /usr/local/bin/
98100
rm -rf nydus-static-v2.3.1-linux-amd64.tgz nydus-static
99-
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
101+
- name: Set up QEMU
102+
uses: docker/setup-qemu-action@v3
100103
- name: Set up Docker Buildx
101104
uses: docker/setup-buildx-action@v3
102105
- name: Log in to the Container registry
@@ -111,12 +114,13 @@ jobs:
111114
with:
112115
images: |
113116
ghcr.io/appthreat/chen
117+
flavor: latest=false,suffix=-amd64
114118
- name: Build and push Docker images
115119
uses: docker/build-push-action@v5
116120
with:
117121
file: ci/Dockerfile
118122
context: .
119-
platforms: linux/amd64,linux/arm64
123+
platforms: linux/amd64
120124
push: true
121125
tags: ${{ steps.meta.outputs.tags }}
122126
labels: ${{ steps.meta.outputs.labels }}
@@ -126,3 +130,114 @@ jobs:
126130
nydusify check --target ${{ steps.meta.outputs.tags }}-nydus
127131
if: github.ref == 'refs/heads/main'
128132
continue-on-error: true
133+
134+
deploy-arm:
135+
if: github.repository_owner == 'appthreat'
136+
runs-on: ubuntu-24.04-arm
137+
outputs:
138+
image-uri: ghcr.io/appthreat/chen@${{ steps.build.outputs.digest }}
139+
permissions:
140+
contents: write
141+
packages: write
142+
steps:
143+
- uses: actions/checkout@v4
144+
with:
145+
fetch-depth: 0
146+
- name: Set up JDK
147+
uses: actions/setup-java@v4
148+
with:
149+
distribution: 'temurin'
150+
java-version: '21'
151+
- uses: sbt/setup-sbt@v1
152+
- name: "Install PHP"
153+
uses: "shivammathur/setup-php@v2"
154+
with:
155+
coverage: "none"
156+
php-version: "8.3"
157+
tools: composer:v2
158+
- name: Set up Python
159+
uses: actions/setup-python@v5
160+
with:
161+
python-version: '3.12'
162+
- name: Use Node.js
163+
uses: actions/setup-node@v4
164+
with:
165+
node-version: '23.x'
166+
- name: Trim CI agent
167+
run: |
168+
chmod +x ci/free_disk_space.sh
169+
./ci/free_disk_space.sh
170+
- name: Delete `.rustup` directory
171+
run: rm -rf /home/runner/.rustup # to save disk space
172+
if: runner.os == 'Linux'
173+
- name: Delete `.cargo` directory # to save disk space
174+
run: rm -rf /home/runner/.cargo
175+
if: runner.os == 'Linux'
176+
- uses: actions/cache@v4
177+
with:
178+
path: |
179+
~/.sbt
180+
~/.coursier
181+
key: ${{ runner.os }}-sbt-${{ hashfiles('**/build.sbt') }}
182+
- run: |
183+
sbt stage createDistribution
184+
env:
185+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186+
SCALAPY_PYTHON_LIBRARY: "python3.12"
187+
- name: Set up QEMU
188+
uses: docker/setup-qemu-action@v3
189+
- name: Set up Docker Buildx
190+
uses: docker/setup-buildx-action@v3
191+
- name: Log in to the Container registry
192+
uses: docker/login-action@v3
193+
with:
194+
registry: ghcr.io
195+
username: ${{ github.actor }}
196+
password: ${{ secrets.GITHUB_TOKEN }}
197+
- name: Extract metadata (tags, labels) for Docker
198+
id: meta
199+
uses: docker/metadata-action@v5
200+
with:
201+
images: |
202+
ghcr.io/appthreat/chen
203+
flavor: latest=false,suffix=-arm64
204+
- name: Build and push Docker images
205+
uses: docker/build-push-action@v5
206+
with:
207+
file: ci/Dockerfile
208+
context: .
209+
platforms: linux/arm64
210+
push: true
211+
tags: ${{ steps.meta.outputs.tags }}
212+
labels: ${{ steps.meta.outputs.labels }}
213+
214+
deploy-manifest:
215+
if: github.repository_owner == 'appthreat'
216+
runs-on: ubuntu-24.04
217+
needs: [deploy, deploy-arm]
218+
outputs:
219+
image-uri: ghcr.io/appthreat/chen@${{ steps.build.outputs.digest }}
220+
permissions:
221+
contents: write
222+
packages: write
223+
steps:
224+
- uses: actions/checkout@v4
225+
with:
226+
fetch-depth: 0
227+
- uses: docker/login-action@v3
228+
with:
229+
registry: ghcr.io
230+
username: ${{ github.actor }}
231+
password: ${{ secrets.GITHUB_TOKEN }}
232+
- uses: docker/metadata-action@v5
233+
id: metadata
234+
with:
235+
images: ghcr.io/${{ github.repository }}
236+
- uses: int128/docker-manifest-create-action@v2
237+
id: build
238+
with:
239+
index-annotations: ${{ steps.metadata.outputs.labels }}
240+
tags: ${{ steps.metadata.outputs.tags }}
241+
sources: |
242+
${{ needs.deploy.outputs.image-uri }}
243+
${{ needs.deploy-arm.outputs.image-uri }}

ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ RUN set -e; \
7777
&& source ~/.bashrc \
7878
&& mkdir -p "$(rbenv root)/plugins" \
7979
&& git clone https://github.com/rbenv/ruby-build.git --depth=1 "$(rbenv root)/plugins/ruby-build" \
80-
&& rbenv install ${RUBY_VERSION} \
80+
&& rbenv install ${RUBY_VERSION} -- --disable-install-doc \
8181
&& rbenv global ${RUBY_VERSION} \
8282
&& ruby --version \
8383
&& which ruby \

0 commit comments

Comments
 (0)