Rebase to 3.18, migrate to s6v3 (#47)

* Rebase to 3.17, migrate to s6v3

* Add ipfs migrations.

* Brackets

* Add build-base for arm builds

* Rebase to 3.18, deprecate armhf

* Fix mismerge of jenkinsfile

* Make dockerfiles consistent

* Update changelog date

* need to use old go to build some of the migrations and ingest chdman from alpine testing repos

* add build deps for aarch64

---------

Co-authored-by: ryan.kuba <ryan.kuba@kasmweb.com>
This commit is contained in:
Adam 2023-09-16 20:37:22 +01:00 committed by GitHub
parent 57b7ef4c50
commit dc7f76dac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 180 additions and 93 deletions

0
.github/workflows/call_issue_pr_tracker.yml vendored Executable file → Normal file
View File

0
.github/workflows/call_issues_cron.yml vendored Executable file → Normal file
View File

View File

@ -1,9 +1,30 @@
FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as binbuilder
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine:3.14 as migrationbuilder
RUN \
echo "**** install build packages ****" && \
apk add \
git \
go
RUN \
echo "**** build fs-repo-migrations ****" && \
mkdir -p /build-out/usr/bin && \
git clone https://github.com/ipfs/fs-repo-migrations.git && \
cd fs-repo-migrations && \
for BUILD in fs-repo-migrations fs-repo-9-to-10 fs-repo-10-to-11 fs-repo-11-to-12; do \
cd ${BUILD} && \
go build && \
mv fs-repo-* /build-out/usr/bin/ && \
cd .. ; \
done
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as binbuilder
RUN \
echo "**** install build packages ****" && \
apk add \
curl \
git \
go
@ -28,15 +49,25 @@ RUN \
chmod +x /tmp/binmerge && \
mv /tmp/binmerge /build-out/usr/local/bin
FROM ghcr.io/linuxserver/baseimage-alpine:3.15 as nodebuilder
RUN \
echo "**** build fs-repo-migrations ****" && \
mkdir /build-out/usr/bin && \
git clone https://github.com/ipfs/fs-repo-migrations.git && \
cd fs-repo-migrations && \
for BUILD in fs-repo-migrations fs-repo-12-to-13; do \
cd ${BUILD} && \
go build && \
mv fs-repo-* /build-out/usr/bin/ && \
cd .. ; \
done
FROM ghcr.io/linuxserver/baseimage-alpine:3.18 as nodebuilder
ARG EMULATORJS_RELEASE
ARG RETRO_VERSION=1.9.10
RUN \
echo "**** install build packages ****" && \
apk add \
curl \
nodejs \
npm \
p7zip \
@ -81,7 +112,7 @@ RUN \
npm install
# runtime stage
FROM ghcr.io/linuxserver/baseimage-alpine:3.15
FROM ghcr.io/linuxserver/baseimage-alpine:3.18
# set version label
ARG BUILD_DATE
@ -92,27 +123,24 @@ LABEL maintainer="thelamer"
RUN \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
file \
flac \
go-ipfs \
kubo \
nginx \
nodejs \
p7zip \
python3 \
sdl2 && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
mame-tools && \
mkdir /data && \
echo "**** grab pre-built chdman ****" && \
curl -L \
"https://infura-ipfs.io/ipfs/QmUfYfuoxPgDRc9Mniv1TBXv6LXPRNArAabZo5VnzfZNtP" \
-o /usr/local/bin/chdman && \
chmod +x /usr/local/bin/chdman && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
# add local files and files from buildstage
COPY --from=binbuilder /build-out/ /
COPY --from=migrationbuilder /build-out/ /
COPY --from=nodebuilder /emulatorjs/ /emulatorjs/
COPY root/ /

View File

@ -1,11 +1,36 @@
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.15 as binbuilder
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.14 as migrationbuilder
RUN \
echo "**** install build packages ****" && \
apk add \
curl \
git \
go
gcc \
go \
musl-dev
RUN \
echo "**** build fs-repo-migrations ****" && \
mkdir -p /build-out/usr/bin && \
git clone https://github.com/ipfs/fs-repo-migrations.git && \
cd fs-repo-migrations && \
for BUILD in fs-repo-migrations fs-repo-9-to-10 fs-repo-10-to-11 fs-repo-11-to-12; do \
cd ${BUILD} && \
go build && \
mv fs-repo-* /build-out/usr/bin/ && \
cd .. ; \
done
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.18 as binbuilder
RUN \
echo "**** install build packages ****" && \
apk add \
git \
gcc \
go \
musl-dev
RUN \
echo "**** build nestool ****" && \
@ -28,14 +53,25 @@ RUN \
chmod +x /tmp/binmerge && \
mv /tmp/binmerge /build-out/usr/local/bin
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.15 as nodebuilder
RUN \
echo "**** build fs-repo-migrations ****" && \
mkdir /build-out/usr/bin && \
git clone https://github.com/ipfs/fs-repo-migrations.git && \
cd fs-repo-migrations && \
for BUILD in fs-repo-migrations fs-repo-9-to-10 fs-repo-10-to-11 fs-repo-11-to-12 fs-repo-12-to-13; do \
cd ${BUILD} && \
go build && \
mv fs-repo-* /build-out/usr/bin/ && \
cd .. ; \
done
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.18 as nodebuilder
ARG EMULATORJS_RELEASE
RUN \
echo "**** install build packages ****" && \
apk add \
curl \
nodejs \
npm \
p7zip \
@ -80,7 +116,7 @@ RUN \
npm install
# runtime stage
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.15
FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.18
# set version label
ARG BUILD_DATE
@ -91,28 +127,24 @@ LABEL maintainer="thelamer"
RUN \
echo "**** install runtime packages ****" && \
apk add --no-cache \
curl \
file \
flac \
kubo \
nginx \
nodejs \
p7zip \
python3 \
sdl2 && \
mkdir /data && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.14/community \
go-ipfs && \
echo "**** grab pre-built chdman ****" && \
curl -L \
"https://infura-ipfs.io/ipfs/QmUqmGm5KUeeWSS9FG9DMuSQPpvU7RqffFR9n3rJXDQ8AQ" \
-o /usr/local/bin/chdman && \
chmod +x /usr/local/bin/chdman && \
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
mame-tools && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
# add local files and files from buildstage
COPY --from=binbuilder /build-out/ /
COPY --from=migrationbuilder /build-out/ /
COPY --from=nodebuilder /emulatorjs/ /emulatorjs/
COPY root/ /

View File

@ -283,6 +283,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **09.06.23:** - Rebase to Alpine 3.18, migrate to s6v3, deprecate armhf.
* **06.07.23:** - Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)
* **24.11.22:** - Update IPFS links for chdman.
* **04.04.22:** - Ingest pre-built chdman bins during build time.

View File

@ -6,6 +6,7 @@ external_type: github_stable
release_type: stable
release_tag: latest
ls_branch: master
build_armhf: false
repo_vars:
- EXT_GIT_BRANCH = 'master'
- EXT_USER = 'linuxserver'

View File

@ -86,6 +86,7 @@ app_setup_block: |
* ws
# changelog
changelogs:
- {date: "09.08.23:", desc: "Rebase to Alpine 3.18, migrate to s6v3."}
- {date: "06.07.23:", desc: "Deprecate armhf. As announced [here](https://www.linuxserver.io/blog/a-farewell-to-arm-hf)"}
- {date: "24.11.22:", desc: "Update IPFS links for chdman."}
- {date: "04.04.22:", desc: "Ingest pre-built chdman bins during build time."}

View File

@ -1,45 +0,0 @@
#!/usr/bin/with-contenv bash
# permissions
chown abc:abc \
/data
# ipfs config
if [ ! -d "/data/.ipfs" ]; then
HOME=/data ipfs init --profile lowpower
chown -R abc:abc /data/.ipfs
fi
# link user data to frontend
if [ ! -L '/emulatorjs/frontend/user' ]; then
ln -s /data /emulatorjs/frontend/user
fi
# Default profile directory
if [ ! -d '/config/profile/default' ]; then
mkdir -p /config/profile/default
echo "input_menu_toggle_gamepad_combo = 3
system_directory = /home/web_user/retroarch/system/" > /config/profile/default/retroarch.cfg
chown -R abc:abc /config/profile
fi
if [ ! -f '/config/profile/profile.json' ]; then
echo '{}' > /config/profile/profile.json
chown -R abc:abc /config/profile
fi
# nginx mime types
cp /defaults/mime.types /etc/nginx/mime.types
# nginx body cache
chown -R abc:root /var/lib/nginx
# allow users to mount in rom dirs
DIRS='3do atari2600 atari7800 colecovision doom gba lynx n64 nes odyssey2 psx segaCD segaMD segaSaturn snes vb ws arcade atari5200 gb gbc jaguar msx nds ngp pce sega32x segaGG segaMS segaSG vectrex'
for DIR in ${DIRS}; do
if [ -d "/data/${DIR}" ]; then
chown abc:abc "/data/${DIR}"
fi
if [ -d "/data/${DIR}/roms" ]; then
chown abc:abc "/data/${DIR}/roms"
fi
done

View File

@ -0,0 +1,52 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# permissions
lsiown abc:abc \
/data
# ipfs migrate check on startup
if [[ -d "/data/.ipfs" ]]; then
echo "[ipfs-upgrade] Checking if fs-repo needs to be upgraded (this may take some time)"
HOME=/data s6-setuidgid abc /usr/bin/fs-repo-migrations -y -to 13
fi
# ipfs config
if [[ ! -d "/data/.ipfs" ]]; then
HOME=/data ipfs init --profile lowpower
lsiown -R abc:abc /data/.ipfs
fi
# link user data to frontend
if [[ ! -L '/emulatorjs/frontend/user' ]]; then
ln -s /data /emulatorjs/frontend/user
fi
# Default profile directory
if [[ ! -d '/config/profile/default' ]]; then
mkdir -p /config/profile/default
echo "input_menu_toggle_gamepad_combo = 3
system_directory = /home/web_user/retroarch/system/" > /config/profile/default/retroarch.cfg
lsiown -R abc:abc /config/profile
fi
if [[ ! -f '/config/profile/profile.json' ]]; then
echo '{}' > /config/profile/profile.json
lsiown -R abc:abc /config/profile
fi
# nginx mime types
cp /defaults/mime.types /etc/nginx/mime.types
# nginx body cache
lsiown -R abc:root /var/lib/nginx
# allow users to mount in rom dirs
DIRS='3do atari2600 atari7800 colecovision doom gba lynx n64 nes odyssey2 psx segaCD segaMD segaSaturn snes vb ws arcade atari5200 gb gbc jaguar msx nds ngp pce sega32x segaGG segaMS segaSG vectrex'
for DIR in ${DIRS}; do
if [[ -d "/data/${DIR}" ]]; then
lsiown abc:abc "/data/${DIR}"
fi
if [[ -d "/data/${DIR}/roms" ]]; then
lsiown abc:abc "/data/${DIR}/roms"
fi
done

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-emulatorjs-config/run

View File

@ -0,0 +1 @@
3

View File

@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
HOME=/data exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 3000" \
cd /emulatorjs s6-setuidgid abc node index.js

View File

@ -0,0 +1 @@
longrun

View File

@ -0,0 +1 @@
4

View File

@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
HOME=/data exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 4001" \
s6-setuidgid abc ipfs daemon

View File

@ -0,0 +1 @@
longrun

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if pgrep -f "[n]ginx:" > /dev/null; then
pkill -ef [n]ginx:
fi
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 80" \
/usr/sbin/nginx -c /etc/nginx/nginx.conf

View File

@ -0,0 +1 @@
longrun

View File

@ -0,0 +1 @@
6

View File

@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
HOME=/config exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 3001" \
cd /emulatorjs s6-setuidgid abc node profile.js

View File

@ -0,0 +1 @@
longrun

View File

@ -1,5 +0,0 @@
#!/usr/bin/with-contenv bash
cd /emulatorjs || exit
HOME=/data exec \
s6-setuidgid abc node index.js

View File

@ -1,4 +0,0 @@
#!/usr/bin/with-contenv bash
HOME=/data exec \
s6-setuidgid abc ipfs daemon

View File

@ -1,7 +0,0 @@
#!/usr/bin/with-contenv bash
if pgrep -f "[n]ginx:" > /dev/null; then
pkill -ef [n]ginx:
fi
exec /usr/sbin/nginx -c /etc/nginx/nginx.conf

View File

@ -1,5 +0,0 @@
#!/usr/bin/with-contenv bash
cd /emulatorjs || exit
HOME=/config exec \
s6-setuidgid abc node profile.js