From edc469deffc21f6bf6bb00a5f66c73217706f274 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 21 Mar 2023 10:22:42 +0800 Subject: [PATCH] build: enhance docker image build --- Dockerfile | 33 ++++++++++++++++++++++----------- init.sh | 2 ++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f93cdb..da78945 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,24 @@ -FROM python:3.7-alpine as build -RUN apk add build-base cargo git libffi-dev openssl-dev && \ - pip install -U pip && cd / && mkdir wheels && \ - git clone --depth=1 --branch=v1.6.9 https://github.com/syncplay/syncplay.git && \ - echo "" > syncplay/requirements_gui.txt && \ - cd wheels && SNAPCRAFT_PART_BUILD=1 pip wheel file:///syncplay#egg=syncplay +ARG PYTHON="python:3.7-alpine3.17" -FROM python:3.7-alpine -COPY ./init.sh /syncplay -COPY --from=build /wheels /wheels -RUN apk add --no-cache openssl libffi && pip install /wheels/*.whl +FROM ${PYTHON} as build +ENV SYNCPLAY="1.6.9" +RUN apk add gcc musl-dev libffi-dev +RUN wget https://github.com/Syncplay/syncplay/archive/refs/tags/v${SYNCPLAY}.tar.gz && \ + tar xf v${SYNCPLAY}.tar.gz +WORKDIR ./syncplay-${SYNCPLAY}/ +RUN cat /dev/null > requirements_gui.txt +RUN SNAPCRAFT_PART_BUILD=1 pip wheel --wheel-dir /wheels/ ./ +WORKDIR /wheels/ +RUN pip install *.whl +RUN ls *.whl | xargs -P0 -n1 unzip -d /unzip/ +WORKDIR /release/lib/python3.7/ +RUN cp -r /unzip/ ./site-packages/ +WORKDIR /release/bin/ +RUN cp /usr/local/bin/syncplay-server ./ +COPY ./init.sh ./syncplay + +FROM ${PYTHON} +RUN apk add --no-cache libffi openssl +COPY --from=build /release/ /usr/local/ EXPOSE 8999 -ENTRYPOINT ["/syncplay"] +ENTRYPOINT ["syncplay"] diff --git a/init.sh b/init.sh index e275d4f..43be853 100755 --- a/init.sh +++ b/init.sh @@ -1,5 +1,7 @@ #!/bin/sh +echo "boot start" + args="--salt=$SALT" [ -n "$TLS" ] && args="$args --tls=$TLS"