Skip to content

Commit

Permalink
containers/general-worker: Change to debian, fix multi-arch, add action
Browse files Browse the repository at this point in the history
* Cleanup unused clang-format too. It's huge.
  • Loading branch information
kallisti5 committed Dec 28, 2024
1 parent 8ca3f77 commit 8f2adaa
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 66 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/general-worker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build general-worker
on:
push:
tags:
- general-worker-*
pull_request:
branches:
- main
jobs:
build:
name: Build general-worker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Detect version
id: detect-version
run: echo "RELEASE_VERSION=$(git describe --dirty --tags --match=general-worker-* --abbrev=1 | sed -r 's/general-worker-//') >> "$GITHUB_OUTPUT"
- name: List version
run: echo "Building ${{ steps.detect-version.outputs.RELEASE_VERSION }}..."
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push multi-architecture image
uses: docker/build-push-action@v5
with:
context: containers/general-worker
push: true
tags: |
ghcr.io/haiku/general-worker:${ steps.detect-version.outputs.RELEASE_VERSION }}-amd64
ghcr.io/haiku/general-worker:${ steps.detect-version.outputs.RELEASE_VERSION }}-arm64
platforms: linux/amd64,linux/arm64
83 changes: 40 additions & 43 deletions containers/general-worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,78 +1,75 @@
FROM docker.io/fedora:34
FROM docker.io/debian:bookworm-slim

MAINTAINER Haiku, Inc. <[email protected]>
LABEL org.opencontainers.image.source https://github.com/haiku/infrastructure
LABEL org.opencontainers.image.url https://github.com/haiku/infrastructure/tree/master/containers/general-worker
LABEL org.opencontainers.image.vendor Haiku, Inc.
LABEL org.opencontainers.image.description Base container for Haiku build automation.

USER root

RUN dnf install -y \
RUN apt update && apt install -y --no-install-recommends \
attr \
autoconf \
automake \
bc \
bison \
buildah \
byacc \
build-essential \
buildah \
bzip2 \
ca-certificates \
cmake \
curl \
curl-devel \
cpio \
device-tree-compiler \
diffutils \
file \
flex \
gcc \
gcc-c++ \
g++ \
gawk \
genisoimage \
git \
glibc-devel \
glibc-devel.i686 \
jq \
libstdc++ \
libstdc++-static \
libstdc++-devel.x86_64 \
libstdc++-devel.i686 \
less \
libcurl4-openssl-dev \
libtool \
libfdt \
libssl-dev \
make \
minisign \
mtools \
nasm \
ninja-build \
python3 \
python3-devel \
sbsigntools \
swig \
sbsigntool \
skopeo \
texinfo \
u-boot-tools \
util-linux \
vim \
uboot-tools \
zip \
unzip \
wget \
zip \
xorriso \
xz \
libzstd \
libzstd-devel \
libzstd-static \
zlib \
zlib-devel

ADD https://dl.min.io/client/mc/release/linux-amd64/mc /usr/local/bin/mc
RUN chmod 755 /usr/local/bin/mc
xz-utils \
zlib1g-dev; \
if [ "$(uname -m)" = "x86_64" ]; then apt install -y gcc-multilib; fi; \
if [ "$(uname -m)" = "x86_64"]; then wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc; fi; \
if [ "$(uname -m)" = "aarch64"]; then wget https://dl.min.io/client/mc/release/linux-arm64/mc -O /usr/local/bin/mc; fi; \
chmod 755 /usr/local/bin/mc; \
cd /tmp && \
wget https://github.com/MestreLion/git-tools/archive/refs/tags/v2022.12.tar.gz -O /tmp/v2022.12.tar.gz && \
tar xvf /tmp/v2022.12.tar.gz git-tools-2022.12/git-restore-mtime && \
mv git-tools-2022.12/git-restore-mtime /usr/local/bin/ && chmod 755 /usr/local/bin/git-restore-mtime && \
rm -rf /tmp/*

RUN git clone --depth 1 https://github.com/viveris/llvm-project.git &&\
cd llvm-project &&\
mkdir build &&\
cd build &&\
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm &&\
make -j 2 clang-format &&\
cp ./bin/clang-format /usr/bin &&\
cp ../clang/tools/clang-format/git-clang-format /usr/bin &&\
cd ../../ &&\
rm -rf llvm-project/ &&\
cd /tmp &&\
wget https://github.com/MestreLion/git-tools/archive/refs/tags/v2020.09.tar.gz -O /tmp/v2020.09.tar.gz &&\
tar xvf /tmp/v2020.09.tar.gz git-tools-2020.09/git-restore-mtime &&\
mv git-tools-2020.09/git-restore-mtime /usr/local/bin/ && chmod 755 /usr/local/bin/git-restore-mtime &&\
rm -rf /tmp/*
# We don't use this in our build pipelines. It's kinda big too.
#RUN git clone --depth 1 https://github.com/viveris/llvm-project.git &&\
# cd llvm-project &&\
# mkdir build &&\
# cd build &&\
# cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm &&\
# make -j 2 clang-format &&\
# cp ./bin/clang-format /usr/bin &&\
# cp ../clang/tools/clang-format/git-clang-format /usr/bin &&\
# cd ../../ &&\
# rm -rf llvm-project/
42 changes: 22 additions & 20 deletions containers/general-worker/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ MAINTAINER Haiku, Inc. <[email protected]>
LABEL org.opencontainers.image.source https://github.com/haiku/infrastructure
LABEL org.opencontainers.image.url https://github.com/haiku/infrastructure/tree/master/containers/general-worker
LABEL org.opencontainers.image.vendor Haiku, Inc.
LABEL org.opencontainers.image.description Base container for Haiku build automation.

USER root

Expand All @@ -24,7 +25,6 @@ RUN apt update && apt install -y --no-install-recommends \
diffutils \
file \
flex \
gcc-multilib \
g++ \
gawk \
genisoimage \
Expand All @@ -51,23 +51,25 @@ RUN apt update && apt install -y --no-install-recommends \
wget \
xorriso \
xz-utils \
zlib1g-dev
zlib1g-dev; \
if [ "$(uname -m)" = "x86_64" ]; then apt install -y gcc-multilib; fi; \
if [ "$(uname -m)" = "x86_64"]; then wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc; fi; \
if [ "$(uname -m)" = "aarch64"]; then wget https://dl.min.io/client/mc/release/linux-arm64/mc -O /usr/local/bin/mc; fi; \
chmod 755 /usr/local/bin/mc; \
cd /tmp && \
wget https://github.com/MestreLion/git-tools/archive/refs/tags/v2022.12.tar.gz -O /tmp/v2022.12.tar.gz && \
tar xvf /tmp/v2022.12.tar.gz git-tools-2022.12/git-restore-mtime && \
mv git-tools-2022.12/git-restore-mtime /usr/local/bin/ && chmod 755 /usr/local/bin/git-restore-mtime && \
rm -rf /tmp/*

ADD https://dl.min.io/client/mc/release/linux-amd64/mc /usr/local/bin/mc
RUN chmod 755 /usr/local/bin/mc

RUN git clone --depth 1 https://github.com/viveris/llvm-project.git &&\
cd llvm-project &&\
mkdir build &&\
cd build &&\
cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm &&\
make -j 2 clang-format &&\
cp ./bin/clang-format /usr/bin &&\
cp ../clang/tools/clang-format/git-clang-format /usr/bin &&\
cd ../../ &&\
rm -rf llvm-project/ &&\
cd /tmp &&\
wget https://github.com/MestreLion/git-tools/archive/refs/tags/v2020.09.tar.gz -O /tmp/v2020.09.tar.gz &&\
tar xvf /tmp/v2020.09.tar.gz git-tools-2020.09/git-restore-mtime &&\
mv git-tools-2020.09/git-restore-mtime /usr/local/bin/ && chmod 755 /usr/local/bin/git-restore-mtime &&\
rm -rf /tmp/*
# We don't use this in our build pipelines. It's kinda big too.
#RUN git clone --depth 1 https://github.com/viveris/llvm-project.git &&\
# cd llvm-project &&\
# mkdir build &&\
# cd build &&\
# cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm &&\
# make -j 2 clang-format &&\
# cp ./bin/clang-format /usr/bin &&\
# cp ../clang/tools/clang-format/git-clang-format /usr/bin &&\
# cd ../../ &&\
# rm -rf llvm-project/
12 changes: 9 additions & 3 deletions containers/general-worker/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
VERSION = latest
VERSION = 20241228
REGISTRY = ghcr.io/haiku
HOST = `uname -m`
default:
podman build --pull --no-cache --tag ${REGISTRY}/general-worker:${VERSION} .
podman build --pull --no-cache --tag ${REGISTRY}/general-worker:${VERSION}-${HOST} .
enter:
podman run -it ${REGISTRY}/general-worker:${VERSION} /bin/bash -l
push:
podman push ${REGISTRY}/general-worker:${VERSION}
podman push ${REGISTRY}/general-worker:${VERSION}-${HOST}
push-manifest:
# Make sure you have all the intended images built and pushed ;-)
podman manifest create ${REGISTRY}/general-worker:${VERSION} \
--amend ${REGISTRY}/general-worker:${VERSION}-x86_64 \
--amend ${REGISTRY}/general-worker:${VERSION}-aarch64 \

0 comments on commit 8f2adaa

Please sign in to comment.