Skip to content

Commit 8736531

Browse files
authored
Merge pull request #53 from psadi/feature/deps
build: ensure the latest dependencies are installed
2 parents 1de5b96 + 9a29399 commit 8736531

File tree

4 files changed

+94
-63
lines changed

4 files changed

+94
-63
lines changed

.github/workflows/image.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: Build Image
2+
concurrency:
3+
group: build-${{ github.ref }}
4+
cancel-in-progress: true
5+
26
on:
37
workflow_dispatch: {}
48
push:
59
paths:
6-
- "Dockerfile"
10+
- "Containerfile"
711
- "setup.sh"
812

913
jobs:
@@ -47,7 +51,7 @@ jobs:
4751
password: "${{ secrets.DOCKER_PASSWORD }}"
4852
continue-on-error: true
4953

50-
- name: Log in to Docker Hub
54+
- name: Log in to Ghcr registry
5155
uses: docker/login-action@v3
5256
with:
5357
registry: ghcr.io
@@ -57,8 +61,24 @@ jobs:
5761
- name: Build and push
5862
uses: docker/build-push-action@v6
5963
with:
64+
file: Containerfile
6065
push: ${{ github.ref_name == 'main' }}
6166
platforms: "linux/amd64,linux/arm64"
6267
tags: |
6368
${{ env.GHCR_NAME }}:latest
6469
${{ env.GHCR_NAME }}:${{ env.DOCKER_TAG }}
70+
71+
# clean:
72+
# needs:
73+
# - buid_base_image
74+
# runs-on: ubuntu-latest
75+
# name: Delete old test images
76+
# steps:
77+
# - uses: snok/[email protected]
78+
# with:
79+
# account: psadi
80+
# token: ${{ secrets.GITHUB_TOKEN }}
81+
# image-names: "ghostty-appimage"
82+
# cut-off: 2w
83+
# keep-n-most-recent: 2
84+
# dry-run: true

Containerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM --platform=$BUILDPLATFORM ghcr.io/pkgforge-dev/archlinux:latest
2+
3+
LABEL org.opencontainers.image.source="https://github.com/psadi/ghostty-appimage"
4+
LABEL org.opencontainers.image.description="Container image for ghostty-appimage dependencies"
5+
LABEL org.opencontainers.image.licenses="MIT"
6+
7+
COPY setup.sh setup.sh
8+
9+
RUN sh setup.sh

Dockerfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.sh

Lines changed: 63 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
#!/bin/sh
22

3-
set -e
3+
set -ex
4+
5+
get_latest_gh_release() {
6+
7+
local gh_ref="${1}"
8+
local version
9+
curl -s "https://api.github.com/repos/${gh_ref}/releases/latest" | jq -r .tag_name
10+
}
11+
12+
# Update & install OS base dependencies
13+
buildDeps="base-devel freetype2 oniguruma wget mesa file zsync appstream xorg-server-xvfb patchelf binutils strace git jq"
14+
ghosttyDeps="gtk4 libadwaita blueprint-compiler"
15+
pacman -Syuq --needed --noconfirm --noprogressbar ${buildDeps} ${ghosttyDeps}
416

517
export ARCH="$(uname -m)"
618

719
ZIG_VERSION="0.13.0"
8-
PANDOC_VERSION="3.6.3"
9-
MINISIGN_VERSION="0.11"
10-
SHARUN_VERSION="v0.3.9"
11-
URUNTIME_VERSION="v0.1.5"
20+
PANDOC_VERSION="$(get_latest_gh_release 'jgm/pandoc')"
21+
MINISIGN_VERSION="$(get_latest_gh_release 'jedisct1/minisign')"
22+
SHARUN_VERSION="$(get_latest_gh_release 'VHSgunzo/sharun')"
23+
URUNTIME_VERSION="$(get_latest_gh_release 'VHSgunzo/uruntime')"
1224

1325
GITHUB_BASE="https://github.com"
1426
PANDOC_BASE="${GITHUB_BASE}/jgm/pandoc/releases/download/${PANDOC_VERSION}"
@@ -37,73 +49,68 @@ case "${ARCH}" in
3749
;;
3850
esac
3951

40-
# Update & install OS base dependencies
41-
buildDeps="base-devel freetype2 oniguruma wget mesa file zsync appstream xorg-server-xvfb patchelf binutils strace git blueprint-compiler"
42-
ghosttyDeps="gtk4 libadwaita"
43-
pacman -Syuq --needed --noconfirm --noprogressbar ${buildDeps} ${ghosttyDeps}
44-
pacman -Scc --noconfirm
45-
4652
# Debloated llvm and libxml2 without libicudata
4753
wget "${LLVM_URL}" -O /tmp/llvm-libs.pkg.tar.zst
4854
wget "${LIBXML_URL}" -O /tmp/libxml2.pkg.tar.zst
4955
pacman -U --noconfirm /tmp/llvm-libs.pkg.tar.zst /tmp/libxml2.pkg.tar.zst
5056

5157
# Download & install other dependencies
52-
# appimagetool: https://github.com/AppImage/appimagetool
53-
if [ ! -f '/usr/local/bin/appimagetool' ]; then
54-
wget "${APPIMAGE_URL}" -O /tmp/appimagetool.AppImage
55-
chmod +x /tmp/appimagetool.AppImage
56-
mv /tmp/appimagetool.AppImage /usr/local/bin/appimagetool
57-
fi
58-
59-
# minisign: https://github.com/jedisct1/minisign
60-
if [ ! -f '/usr/local/bin/minisign' ]; then
61-
wget "${MINISIGN_URL}" -O /tmp/minisign-linux.tar.gz
62-
tar -xzf /tmp/minisign-linux.tar.gz -C /tmp
63-
mv /tmp/minisign-linux/"${ARCH}"/minisign /usr/local/bin
64-
fi
65-
6658
# zig: https://ziglang.org
6759
if [ ! -d "/opt/zig-linux-${ARCH}-${ZIG_VERSION}" ]; then
60+
rm -rf /opt/zig*
61+
unlink /usr/local/bin/zig || true
6862
wget "${ZIG_URL}" -O /tmp/zig-linux.tar.xz
69-
tar -xf /tmp/zig-linux.tar.xz -C /opt
63+
tar -xJf /tmp/zig-linux.tar.xz -C /opt
7064
ln -s "/opt/zig-linux-${ARCH}-${ZIG_VERSION}/zig" /usr/local/bin/zig
7165
fi
7266

73-
# pandoc: https://github.com/jgm/pandoc
74-
if [ ! -f '/usr/local/bin/pandoc' ]; then
75-
wget "${PANDOC_URL}" -O /tmp/pandoc-linux.tar.gz
76-
tar -xzf /tmp/pandoc-linux.tar.gz -C /tmp
77-
mv /tmp/"pandoc-${PANDOC_VERSION}"/bin/* /usr/local/bin
78-
fi
79-
80-
if [ ! -f '/usr/local/bin/lib4bin' ]; then
81-
wget "${LIB4BIN_URL}" -O /usr/local/bin/lib4bin
82-
chmod +x /usr/local/bin/lib4bin
83-
fi
84-
85-
if [ ! -f '/usr/local/bin/sharun' ]; then
86-
wget "${SHARUN_URL}" -O /usr/local/bin/sharun
87-
chmod +x /usr/local/bin/sharun
88-
fi
67+
# appimagetool: https://github.com/AppImage/appimagetool
68+
rm -rf /usr/local/bin/appimagetool
69+
wget "${APPIMAGE_URL}" -O /tmp/appimagetool.AppImage
70+
chmod +x /tmp/appimagetool.AppImage
71+
mv /tmp/appimagetool.AppImage /usr/local/bin/appimagetool
8972

90-
if [ ! -f '/usr/local/bin/uruntime' ]; then
91-
wget "${URUNTIME_URL}" -O /usr/local/bin/uruntime
92-
chmod +x /usr/local/bin/uruntime
93-
fi
73+
# minisign: https://github.com/jedisct1/minisign
74+
rm -rf /usr/local/bin/minisign
75+
wget "${MINISIGN_URL}" -O /tmp/minisign-linux.tar.gz
76+
tar -xzf /tmp/minisign-linux.tar.gz -C /tmp
77+
mv /tmp/minisign-linux/"${ARCH}"/minisign /usr/local/bin
9478

95-
if [ ! -f '/opt/path-mapping.so' ]; then
96-
git clone https://github.com/fritzw/ld-preload-open.git
97-
(
98-
cd ld-preload-open
99-
make all
100-
mv ./path-mapping.so ../
101-
)
102-
rm -rf ld-preload-open
103-
mv ./path-mapping.so /opt/path-mapping.so
104-
fi
79+
# pandoc: https://github.com/jgm/pandoc
80+
rm -rf /usr/local/bin/pandoc*
81+
wget "${PANDOC_URL}" -O /tmp/pandoc-linux.tar.gz
82+
tar -xzf /tmp/pandoc-linux.tar.gz -C /tmp
83+
mv /tmp/"pandoc-${PANDOC_VERSION}"/bin/* /usr/local/bin
84+
85+
# lib4bin: https://github.com/VHSgunzo/sharun/blob/main/lib4bin
86+
rm -rf /usr/local/bin/lib4bin
87+
wget "${LIB4BIN_URL}" -O /usr/local/bin/lib4bin
88+
chmod +x /usr/local/bin/lib4bin
89+
90+
# sharun: https://github.com/VHSgunzo/sharun
91+
rm -rf /usr/local/bin/sharun
92+
wget "${SHARUN_URL}" -O /usr/local/bin/sharun
93+
chmod +x /usr/local/bin/sharun
94+
95+
# uruntime: https://github.com/VHSgunzo/uruntime
96+
rm -rf /usr/local/bin/uruntime
97+
wget "${URUNTIME_URL}" -O /usr/local/bin/uruntime
98+
chmod +x /usr/local/bin/uruntime
99+
100+
# ld-preload-open: https://github.com/fritzw/ld-preload-open
101+
rm -rf /opt/path-mapping.so
102+
git clone https://github.com/fritzw/ld-preload-open.git
103+
(
104+
cd ld-preload-open
105+
make all
106+
mv ./path-mapping.so ../
107+
)
108+
rm -rf ld-preload-open
109+
mv ./path-mapping.so /opt/path-mapping.so
105110

106111
# Cleanup
112+
pacman -Scc --noconfirm
113+
107114
rm -rf \
108115
/tmp/appimagetool.AppImage \
109116
/tmp/minisign-linux* \

0 commit comments

Comments
 (0)