build docker for x32 aarch64 armhf ppc64 s390x

This commit is contained in:
ed 2023-02-18 23:04:55 +00:00
parent 96d6bcf26e
commit a80579f63a
9 changed files with 171 additions and 37 deletions

View file

@ -1,5 +1,10 @@
FROM alpine:latest FROM alpine:latest
WORKDIR /z WORKDIR /z
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-ac" \
org.opencontainers.image.description="copyparty with Pillow and FFmpeg (image/audio/video thumbnails, audio transcoding, media tags)"
RUN apk --no-cache add \ RUN apk --no-cache add \
wget \ wget \
@ -13,9 +18,3 @@ COPY i/dist/copyparty-sfx.py ./
WORKDIR /w WORKDIR /w
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"]
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-ac" \
org.opencontainers.image.description="copyparty with Pillow and FFmpeg (image/audio/video thumbnails, audio transcoding, media tags)"

View file

@ -1,5 +1,10 @@
FROM alpine:latest FROM alpine:latest
WORKDIR /z WORKDIR /z
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-dj" \
org.opencontainers.image.description="copyparty with all optional dependencies, including musical key / bpm detection"
COPY i/bin/mtag/install-deps.sh ./ COPY i/bin/mtag/install-deps.sh ./
COPY i/bin/mtag/audio-bpm.py /mtag/ COPY i/bin/mtag/audio-bpm.py /mtag/
@ -28,9 +33,3 @@ COPY i/dist/copyparty-sfx.py ./
WORKDIR /w WORKDIR /w
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"]
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-dj" \
org.opencontainers.image.description="copyparty with all optional dependencies, including musical key / bpm detection"

View file

@ -1,5 +1,10 @@
FROM alpine:latest FROM alpine:latest
WORKDIR /z WORKDIR /z
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-im" \
org.opencontainers.image.description="copyparty with Pillow and Mutagen (image thumbnails, media tags)"
RUN apk --no-cache add \ RUN apk --no-cache add \
wget \ wget \
@ -12,9 +17,3 @@ COPY i/dist/copyparty-sfx.py ./
WORKDIR /w WORKDIR /w
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"]
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-im" \
org.opencontainers.image.description="copyparty with Pillow and Mutagen (image thumbnails, media tags)"

View file

@ -1,5 +1,10 @@
FROM alpine:latest FROM alpine:latest
WORKDIR /z WORKDIR /z
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-iv" \
org.opencontainers.image.description="copyparty with Pillow, FFmpeg, libvips (image/audio/video thumbnails, audio transcoding, media tags)"
RUN apk --no-cache add \ RUN apk --no-cache add \
wget \ wget \
@ -16,9 +21,3 @@ COPY i/dist/copyparty-sfx.py ./
WORKDIR /w WORKDIR /w
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"]
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-iv" \
org.opencontainers.image.description="copyparty with Pillow, FFmpeg, libvips (image/audio/video thumbnails, audio transcoding, media tags)"

View file

@ -1,5 +1,10 @@
FROM alpine:latest FROM alpine:latest
WORKDIR /z WORKDIR /z
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-min" \
org.opencontainers.image.description="just copyparty, no thumbnails / media tags / audio transcoding"
RUN apk --no-cache add \ RUN apk --no-cache add \
python3 \ python3 \
@ -11,9 +16,3 @@ COPY i/dist/copyparty-sfx.py ./
WORKDIR /w WORKDIR /w
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "/z/copyparty-sfx.py", "-c", "/z/initcfg"]
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-min" \
org.opencontainers.image.description="just copyparty, no thumbnails / media tags / audio transcoding"

View file

@ -1,5 +1,10 @@
FROM alpine:latest FROM alpine:latest
WORKDIR /z WORKDIR /z
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-min-pip" \
org.opencontainers.image.description="just copyparty, no thumbnails, no media tags, no audio transcoding"
RUN apk --no-cache add python3 py3-pip \ RUN apk --no-cache add python3 py3-pip \
&& python3 -m pip install copyparty \ && python3 -m pip install copyparty \
@ -11,9 +16,3 @@ RUN apk --no-cache add python3 py3-pip \
WORKDIR /w WORKDIR /w
EXPOSE 3923 EXPOSE 3923
ENTRYPOINT ["python3", "-m", "copyparty", "-c", "/z/initcfg"] ENTRYPOINT ["python3", "-m", "copyparty", "-c", "/z/initcfg"]
LABEL org.opencontainers.image.url="https://github.com/9001/copyparty" \
org.opencontainers.image.source="https://github.com/9001/copyparty/tree/hovudstraum/scripts/docker" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="copyparty-min-pip" \
org.opencontainers.image.description="just copyparty, no thumbnails, no media tags, no audio transcoding"

View file

@ -71,7 +71,7 @@ or using commandline arguments,
# build the images yourself # build the images yourself
put `copyparty-sfx.py` into `../dist/` (or [build that from scratch](../../docs/devnotes.md#just-the-sfx) too) then run `make` basically `./make.sh hclean pull img push` but see [devnotes.md](./devnotes.md)
# notes # notes

View file

@ -0,0 +1,19 @@
# building the images yourself
```bash
./make.sh hclean pull img push
```
will download the latest copyparty-sfx.py from github unless you have [built it from scratch](../../docs/devnotes.md#just-the-sfx) and then build all the images based on that
deprecated alternative: run `make` to use the makefile however that uses docker instead of podman and only builds x86_64
`make.sh` is necessarily(?) overengineered because:
* podman keeps burning dockerhub pulls by not using the cached images (`--pull=never` does not apply to manifests)
* podman cannot build from a local manifest, only local images or remote manifests
but I don't really know what i'm doing here 💩
* auth for pushing images to repos;
`podman login docker.io`
`podman login ghcr.io -u 9001`
[about gchq](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) (takes a classic token as password)

121
scripts/docker/make.sh Executable file
View file

@ -0,0 +1,121 @@
#!/bin/bash
set -e
[ $(id -u) -eq 0 ] && {
echo dont root
exit 1
}
sarchs="386 amd64 arm/v7 arm64/v8 ppc64le s390x"
archs="amd64 arm s390x 386 arm64 ppc64le"
imgs="min im ac iv dj"
dhub_order="iv dj min im ac"
ghcr_order="ac im min dj iv"
ngs=(
iv-{arm,arm64,ppc64le,s390x}
dj-{arm,arm64,ppc64le,s390x}
)
for v in "$@"; do
[ "$v" = clean ] && clean=1
[ "$v" = hclean ] && hclean=1
[ "$v" = purge ] && purge=1
[ "$v" = pull ] && pull=1
[ "$v" = img ] && img=1
[ "$v" = push ] && push=1
[ "$v" = sh ] && sh=1
done
[ $# -gt 0 ] || {
echo "need list of commands, for example: hclean pull img push"
exit 1
}
[ $sh ] && {
printf "\n\033[1;31mopening a shell in the most recently created docker image\033[0m\n"
podman run --rm -it --entrypoint /bin/ash $(podman images -aq | head -n 1)
exit $?
}
filt=
[ $clean ] && filt='/<none>/{print$$3}'
[ $hclean ] && filt='/localhost\/copyparty-|^<none>.*localhost\/alpine-/{print$3}'
[ $purge ] && filt='NR>1{print$3}'
[ $filt ] && {
[ $purge ] && {
podman kill $(podman ps -q)
podman rm $(podman ps -qa)
}
podman rmi -f $(podman images -a --history | awk "$filt") || true
}
[ $pull ] && {
for a in $sarchs; do # arm/v6
podman pull --arch=$a alpine:latest
done
podman images --format "{{.ID}} {{.History}}" |
awk '/library\/alpine/{print$1}' |
while read id; do
tag=alpine-$(podman inspect $id | jq -r '.[]|.Architecture' | tr / -)
[ -e .tag-$tag ] && continue
touch .tag-$tag
echo tagging $tag
podman untag $id
podman tag $id $tag
done
rm .tag-*
}
[ $img ] && {
fp=../../dist/copyparty-sfx.py
[ -e $fp ] || {
echo downloading copyparty-sfx.py ...
mkdir -p ../../dist
wget https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py -O $fp
}
rm -rf i err
mkdir i
tar -cC../.. dist/copyparty-sfx.py bin/mtag | tar -xvCi
ps aux | awk '/bin\/qemu-[^-]+-static/{print$2}' | xargs -r kill -9
for i in $imgs; do
podman rm copyparty-$i || true
for a in $archs; do
[[ " ${ngs[*]} " =~ " $i-$a " ]] && continue
aa="$(printf '%7s' $a)"
# --pull=never does nothing at all btw
(set -x
podman build \
--pull=never \
--from localhost/alpine-$a \
--manifest copyparty-$i \
-t copyparty-$i-$a \
-f Dockerfile.$i . || (echo $? $a >> err)
) 2> >(tee $a.err | sed "s/^/$aa:/" >&2) > >(tee $a.out | sed "s/^/$aa:/") &
done
set +x
wait
[ -e err ] && {
echo somethign died,
cat err
exit 1
}
for a in $archs; do
rm $a.{out,err}
done
done
}
[ $push ] && {
for i in $dhub_order; do
podman manifest push --all copyparty-$i copyparty/$i:latest
done
for i in $ghcr_order; do
podman manifest push --all copyparty-$i ghcr.io/9001/copyparty-$i:latest
done
}
echo ok