[add] docker build
This commit is contained in:
parent
43b04dea1d
commit
f624676d85
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
FROM --platform=$TARGETPLATFORM docker.io/library/node:16-alpine as deemix
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
|
||||
RUN echo "Building for TARGETPLATFORM=$TARGETPLATFORM | BUILDPLATFORM=$BUILDPLATFORM"
|
||||
RUN apk add --no-cache git jq python3 make gcc musl-dev g++ && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
COPY . /app
|
||||
WORKDIR app
|
||||
RUN case "$TARGETPLATFORM" in \
|
||||
"linux/amd64") \
|
||||
jq '.pkg.targets = ["node16-alpine-x64"]' ./server/package.json > tmp-json ;; \
|
||||
"linux/arm64") \
|
||||
jq '.pkg.targets = ["node16-alpine-arm64"]' ./server/package.json > tmp-json ;; \
|
||||
"linux/arm64/v8") \
|
||||
jq '.pkg.targets = ["node16-alpine-arm64"]' ./server/package.json > tmp-json ;; \
|
||||
*) \
|
||||
echo "Platform $TARGETPLATFORM not supported" && exit 1 ;; \
|
||||
esac && \
|
||||
mv tmp-json /app/server/package.json
|
||||
RUN yarn install-all
|
||||
RUN yarn dist-server
|
||||
RUN mv /app/dist/deemix-server /deemix-server
|
||||
|
||||
FROM lsiobase/alpine:3.19
|
||||
|
||||
COPY --from=deemix /deemix-server /deemix-server
|
||||
COPY docker-root/ /
|
||||
|
||||
EXPOSE 6595
|
||||
ENTRYPOINT [ "/init" ]
|
8
Makefile
Normal file
8
Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
docker_build_local:
|
||||
docker build -t deemixer:latest .
|
||||
|
||||
docker_build_release_latest:
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
-t gitea.va.reichard.io/evan/deemixer:latest \
|
||||
--push .
|
@ -4,6 +4,10 @@ This is forked from [deemix-webui](https://gitlab.com/RemixDev/deemix-webui) and
|
||||
|
||||
The submodule reference was removed and consolidated into this single repo. Git history was maintained.
|
||||
|
||||
## Building Docker Image
|
||||
|
||||
make docker_build_local
|
||||
|
||||
## Running from source
|
||||
|
||||
You need to use nodejs 16.x, using `yarn` is recommended.
|
||||
|
30
docker-root/etc/cont-init.d/10-fix_folders
Normal file
30
docker-root/etc/cont-init.d/10-fix_folders
Normal file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# test write access to download and config folder and test internet connectivity
|
||||
printf '[cont-init.d] Fixing Folder Permissions - Config Folder\n'
|
||||
|
||||
chown -R abc:abc /config
|
||||
|
||||
printf '[cont-init.d] Fixing Folder Permissions - Temp Folder\n'
|
||||
|
||||
mkdir /tmp/deemix-imgs/
|
||||
chown -R abc:abc /tmp/deemix-imgs/
|
||||
|
||||
# find all folders in the download folder and own them to the container user. This will not change files but should run quicker on big collections.
|
||||
if [ ! -z ${DISABLE_OWNERSHIP_CHECK} ]; then
|
||||
printf '[cont-init.d] Download Folder Ownership Check disabled by Environment Variable\n'
|
||||
else
|
||||
printf '[cont-init.d] Fixing Folder Permissions - Downloads Folder\n'
|
||||
find /downloads -type d -exec chown abc:abc {} +
|
||||
fi
|
||||
|
||||
|
||||
# add executability to server
|
||||
chmod +x /deemix-server
|
||||
|
||||
# Fix misconfigured download locations. The container's download map is always /downloads.
|
||||
if [ -f "/config/config.json" ]; then
|
||||
jq '.downloadLocation = "/downloads"' /config/config.json > tmp.$$.json && mv tmp.$$.json /config/config.json
|
||||
chown abc:abc /config/config.json
|
||||
fi
|
||||
|
9
docker-root/etc/cont-init.d/15-checks
Normal file
9
docker-root/etc/cont-init.d/15-checks
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
# test write access to download and config folder and test internet connectivity
|
||||
printf '[cont-init.d] Testing Access\n' && \
|
||||
printf '%-50s %2s %-5s \n' "[cont-init.d] Container Builddate" ":" "$BUILDDATEENV" && \
|
||||
if [ -w "/downloads" ]; then printf '%-50s %2s %-5s \n' "[cont-init.d] Download Folder Write Access" ":" "Success"; else printf '%-50s %2s %-5s \n' "[cont-init.d] Download Folder Write Access" ":" "Failure"; fi && \
|
||||
if [ -w "/config" ]; then printf '%-50s %2s %-5s \n' "[cont-init.d] Config Folder Write Access" ":" "Success"; else printf '%-50s %2s %-5s \n' "[cont-init.d] Config Folder Write Access" ":" "Failure"; fi && \
|
||||
until curl --fail -sf www.deezer.com; do printf '%-50s %2s %-5s \n' "[cont-init.d] Internet Access" ":" "Failure. Trying again in 5 seconds"; sleep 5; done
|
||||
printf '%-50s %2s %-5s \n' "[cont-init.d] Internet Access" ":" "Success"
|
26
docker-root/etc/services.d/deemix/run
Normal file
26
docker-root/etc/services.d/deemix/run
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
UMASK_SET=${UMASK_SET:-022}
|
||||
umask "$UMASK_SET"
|
||||
|
||||
cd /
|
||||
|
||||
# Check if an alternative port was defined, set it to it or default
|
||||
if [ ! -z ${INTPORT} ]; then
|
||||
port=$INTPORT
|
||||
else
|
||||
port=6595
|
||||
fi
|
||||
|
||||
# Check if the ARL environment var is set to anything. This enables legacy behavior
|
||||
if [ ! -z ${ARL} ]; then
|
||||
export DEEMIX_SINGLE_USER=true
|
||||
fi
|
||||
|
||||
export DEEMIX_DATA_DIR=/config/
|
||||
export DEEMIX_MUSIC_DIR=/downloads/
|
||||
export DEEMIX_SERVER_PORT=$port
|
||||
export DEEMIX_HOST=0.0.0.0
|
||||
|
||||
echo "[services.d] Starting Deemixer"
|
||||
s6-setuidgid abc /deemix-server
|
Loading…
Reference in New Issue
Block a user