Skip to content

Commit f7af9bd

Browse files
authored
chore: support arm builds (#75)
1 parent 0f74808 commit f7af9bd

File tree

4 files changed

+70
-14
lines changed

4 files changed

+70
-14
lines changed

.github/workflows/release.yaml

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ permissions:
2525

2626
jobs:
2727
release:
28-
runs-on: ubuntu-20.04
28+
strategy:
29+
matrix:
30+
os: ["ubuntu-22.04", "depot-ubuntu-22.04-arm"]
31+
include:
32+
- os: ubuntu-22.04
33+
arch: linux/amd64
34+
sha: cfce811006a27305071b1634ca8fe690392f5dcc205612e7b4e5bde411b7701e
35+
arch-suffix: amd64
36+
- os: depot-ubuntu-22.04-arm
37+
arch: linux/arm64
38+
sha: 4b475e7e7eed79708b2707a67d556a5d3c0bdaef0a1f341311d095d1b4b3e271
39+
arch-suffix: arm64
40+
runs-on: ${{ matrix.os }}
2941
steps:
3042
- name: Docker Login
3143
uses: docker/login-action@v2
@@ -64,15 +76,52 @@ jobs:
6476
git config --global user.name "Coder CI"
6577
6678
- name: Build Image
67-
run: make -j build/image/envbox
79+
run: make -j ARCH=${{ matrix.arch }} SYSBOX_SHA=${{ matrix.sha }} build/image/envbox
6880

6981
- name: Tag Image
70-
run: docker tag envbox ghcr.io/coder/envbox:${{ github.event.inputs.version }}
82+
run: docker tag envbox ghcr.io/coder/envbox:${{ github.event.inputs.version }}-${{ matrix.arch-suffix }}
7183

84+
- name: Push Image
85+
run: docker push ghcr.io/coder/envbox:${{ github.event.inputs.version }}-${{ matrix.arch-suffix }}
86+
manifest:
87+
runs-on: ubuntu-22.04
88+
needs: release
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v3
92+
with:
93+
fetch-depth: 0
94+
ref: ${{ github.event.inputs.commit }}
95+
- name: Docker Login
96+
uses: docker/login-action@v2
97+
with:
98+
registry: ghcr.io
99+
username: ${{ github.actor }}
100+
password: ${{ secrets.GITHUB_TOKEN }}
101+
- name: Create Manifest
102+
run: |
103+
docker manifest create ghcr.io/coder/envbox:${{ github.event.inputs.version }} \
104+
--amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-amd64 \
105+
--amend ghcr.io/coder/envbox:${{ github.event.inputs.version }}-arm64
106+
- name: Push Manifest
107+
run: docker manifest push ghcr.io/coder/envbox:${{ github.event.inputs.version }}
108+
109+
tag:
110+
runs-on: ubuntu-22.04
111+
needs: manifest
112+
steps:
113+
- name: Checkout
114+
uses: actions/checkout@v3
115+
with:
116+
fetch-depth: 0
117+
ref: ${{ github.event.inputs.commit }}
118+
- name: Setup Git
119+
run: |
120+
git config --global user.email "[email protected]"
121+
git config --global user.name "Coder CI"
72122
- name: Tag and Push Commit
73123
run: |
74124
git tag -a ${{ github.event.inputs.version }} -m ${{ github.event.inputs.version }}
75125
git push --tags
76126
77-
- name: Push Image
78-
run: docker push ghcr.io/coder/envbox:${{ github.event.inputs.version }}
127+

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
PROJECT_ROOT := $(shell git rev-parse --show-toplevel)
22
GO_FILES := $(shell git ls-files '*.go' '*.sum')
33
IMAGE_FILES := $(shell find deploy)
4+
ARCH ?= linux/amd64
5+
SYSBOX_SHA ?= cfce811006a27305071b1634ca8fe690392f5dcc205612e7b4e5bde411b7701e
46

57
.PHONY: clean
68
clean:
@@ -15,7 +17,7 @@ build/image/envbox: build/image/envbox/.ctx
1517
build/image/envbox/.ctx: build/envbox $(IMAGE_FILES)
1618
mkdir -p $(@D)
1719
cp -r build/envbox deploy/. $(@D)
18-
docker build -t envbox $(@D)
20+
docker buildx build --build-arg SYSBOX_SHA=$(SYSBOX_SHA) -t envbox --platform $(ARCH) $(@D)
1921
touch $@
2022

2123
.PHONY: fmt

deploy/Dockerfile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
# Ubuntu 20.04 LTS (Focal Fossa)
2-
FROM ubuntu:focal
1+
# Ubuntu 22.04 LTS (Jammy Jellyfish)
2+
FROM ubuntu:jammy
3+
4+
ARG TARGETARCH
5+
ARG SYSBOX_SHA="cfce811006a27305071b1634ca8fe690392f5dcc205612e7b4e5bde411b7701e"
6+
ARG SYSBOX_VERSION="0.6.3"
7+
ARG SYSBOX_DEB="sysbox-ce_$SYSBOX_VERSION-0.linux_$TARGETARCH.deb"
38

49
# Copy configuration files to appropriate locations
510
COPY files /
@@ -14,7 +19,7 @@ LABEL \
1419
ARG DEBIAN_FRONTEND=noninteractive
1520
# Pin docker to avoid any breaking API changes between the Go client and
1621
# the server.
17-
ARG DOCKER_VERSION="5:24.0.3-1~ubuntu.20.04~focal"
22+
ARG DOCKER_VERSION="5:24.0.3-1~ubuntu.22.04~jammy"
1823
# Ignore other repositories, as some require HTTPS
1924
RUN apt-get update --quiet --option Dir::Etc::SourceParts="" && \
2025
apt-get upgrade -y && \
@@ -46,10 +51,10 @@ RUN apt-get update --quiet --option Dir::Etc::SourceParts="" && \
4651
apt-get clean && \
4752
rm -rf /var/lib/apt/lists/*
4853

49-
RUN wget https://downloads.nestybox.com/sysbox/releases/v0.6.3/sysbox-ce_0.6.3-0.linux_amd64.deb && \
50-
echo "cfce811006a27305071b1634ca8fe690392f5dcc205612e7b4e5bde411b7701e sysbox-ce_0.6.3-0.linux_amd64.deb" | sha256sum --check --status && \
51-
apt install -y ./sysbox-ce_0.6.3-0.linux_amd64.deb && \
52-
rm ./sysbox-ce_0.6.3-0.linux_amd64.deb && \
54+
RUN wget https://downloads.nestybox.com/sysbox/releases/v$SYSBOX_VERSION/$SYSBOX_DEB && \
55+
echo "$SYSBOX_SHA $SYSBOX_DEB" | sha256sum --check --status && \
56+
apt install -y "./$SYSBOX_DEB" && \
57+
rm "./$SYSBOX_DEB" && \
5358
userdel -r sysbox
5459

5560
# This is jank but sysbox adds their own /etc/docker/daemon.json that overwrites ours when it gets installed,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
deb [signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable
1+
deb [signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable

0 commit comments

Comments
 (0)