Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed dependency on unmaintained docker container #11926

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 43 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
# Need this image for the /bin/start-build script.
# Build unrar. It has been moved to non-free since Alpine 3.15.
# https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.15.0#unrar_moved_to_non-free
FROM jlesage/alpine-abuild:3.15 AS unrar
WORKDIR /tmp
FROM python:3.10.16-alpine3.21 AS builder

ARG TARGETARCH
ARG CXXFLAGS
ARG UNRAR_VERSION=7.0.9
# Use all cores to compile, set JOBS=1 to disable
ARG JOBS
# Build unrar
WORKDIR /unrar
RUN \
mkdir /tmp/aport && \
cd /tmp/aport && \
git init && \
git remote add origin https://github.com/alpinelinux/aports && \
git config core.sparsecheckout true && \
echo "non-free/unrar/*" >> .git/info/sparse-checkout && \
git pull origin 3.15-stable && \
PKG_SRC_DIR=/tmp/aport/non-free/unrar && \
PKG_DST_DIR=/tmp/unrar-pkg && \
mkdir "$PKG_DST_DIR" && \
/bin/start-build -r && \
rm /tmp/unrar-pkg/*-doc-* && \
mkdir /tmp/unrar-install && \
tar xf /tmp/unrar-pkg/unrar-*.apk -C /tmp/unrar-install

FROM python:3.10.8-alpine3.15
echo "**** install build dependencies ****" && \
apk add --no-cache --virtual=build-dependencies \
build-base \
curl \
linux-headers && \
echo "**** install unrar from source ****" && \
mkdir /tmp/unrar && \
curl -o \
/tmp/unrar.tar.gz -L \
"https://www.rarlab.com/rar/unrarsrc-${UNRAR_VERSION}.tar.gz" && \
tar xf \
/tmp/unrar.tar.gz -C \
/unrar --strip-components=1 && \
sed -i 's|LDFLAGS=-pthread|LDFLAGS=-pthread -static|' makefile && \
if [ -z $CXXFLAGS ]; then \
if [ "$TARGETARCH"x == "amd64"x ]; then \
CXXFLAGS='-march=x86-64'; \
elif [ "$TARGETARCH"x == "arm64"x ]; then \
CXXFLAGS='-march=armv8-a+crypto+crc'; \
elif [ "$TARGETARCH"x == "arm"x ]; then \
CXXFLAGS='-march=armv7-a -mfloat-abi=hard -mfpu=neon'; \
fi \
fi && \
sed -i "s|CXXFLAGS=-march=native|CXXFLAGS=$CXXFLAGS|" makefile && \
make -j ${JOBS} && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/root/.cache \
/tmp/*

FROM python:3.10.16-alpine3.21
LABEL maintainer="pymedusa"

ARG GIT_BRANCH
Expand All @@ -30,6 +51,7 @@ ENV MEDUSA_COMMIT_HASH $GIT_COMMIT
ARG BUILD_DATE
LABEL build_version="Branch: $GIT_BRANCH | Commit: $GIT_COMMIT | Build-Date: $BUILD_DATE"

COPY --from=builder /unrar/unrar /usr/bin
# Install packages
RUN \
# Update
Expand All @@ -49,9 +71,6 @@ RUN \
# Install app
COPY . /app/medusa/

# Copy unrar bin
COPY --from=unrar /tmp/unrar-install/usr/bin/unrar /usr/bin/

# Ports and Volumes
EXPOSE 8081
VOLUME /config /downloads /tv /anime
Expand Down