Skip to content

Commit

Permalink
[sickchill] uv, new dockerfile on ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
offbyone committed Sep 9, 2024
1 parent b6902c1 commit 71c90ae
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 35 deletions.
62 changes: 38 additions & 24 deletions sickchill/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
FROM debian:bookworm as compile-sickchill
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
# python virtualenv construction
python-is-python3 python3-venv
ARG UV_VERSION=0.4.2
FROM ubuntu:noble as compile-sickchill

# prepare the sickchill venv
RUN python -mvenv /app/sickchill
RUN apt-get update && \
apt-get install -y --no-install-recommends \
# python virtualenv construction \
python-is-python3 python3-venv \
# for building in general \
build-essential pkg-config \
# for rust \
curl ca-certificates \
# python sources need these. Mainly sickchill \
libffi-dev libxml2-dev libxslt-dev libssl-dev

# Sadly, on most platforms this needs to build Rust.
RUN apt-get install -y --no-install-recommends \
# for rust
curl ca-certificates
RUN curl https://sh.rustup.rs -sSf | bash -x -s -- -y

# needed to work around https://github.com/rust-lang/cargo/issues/8719
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
# Security-conscious organizations should package/review uv themselves.
COPY --from=ghcr.io/astral-sh/uv:0.4.2 /uv /bin/uv

# - Silence uv complaining about not being able to use hard links,
# - tell uv to byte-compile packages for faster application startups,
# - prevent uv from accidentally downloading isolated Python builds,
# - and finally pick a Python.
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
UV_PYTHON=python3.12 \
# needed to work around https://github.com/rust-lang/cargo/issues/8719 \
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

RUN apt-get install -y --no-install-recommends \
# for building in general
gcc build-essential pkg-config \
# python sources need these. Mainly sickchill
python3-dev libffi-dev libxml2-dev libxslt-dev libssl-dev
gcc build-essential pkg-config

ADD requirements.txt /src/requirements.txt

RUN . /root/.cargo/env && \
. /app/sickchill/bin/activate && \
python -mpip install --upgrade pip pip-tools && \
pip-sync /src/requirements.txt
WORKDIR /app

RUN --mount=type=cache,target=/root/.cache \
. /root/.cargo/env && \
uv venv && \
uv pip sync /src/requirements.txt

FROM debian:bookworm-slim AS runtime-image
FROM ubuntu:noble AS runtime-image
VOLUME /var/lib/sickchill
VOLUME /mnt/media
EXPOSE 8080

COPY --from=compile-sickchill /app/sickchill /app/sickchill
COPY --from=compile-sickchill /app/.venv /app/.venv

# Dependencies last, because I don't need them to set the rest up
RUN apt-get update && \
Expand All @@ -47,8 +59,10 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

CMD . /app/sickchill/bin/activate && \
exec python -m SickChill \
COPY --from=ghcr.io/astral-sh/uv:0.4.2 /uv /bin/uv

WORKDIR /app
CMD uv run python -m SickChill \
--datadir=/var/lib/sickchill \
--config /var/lib/sickchill/config.ini \
--nolaunch --port 8080
3 changes: 2 additions & 1 deletion sickchill/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sickchill==2024.3.1
sickchill==2024.3.1
setuptools
18 changes: 8 additions & 10 deletions sickchill/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-emit-index-url --no-emit-trusted-host /src/requirements.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in -o requirements.txt --no-emit-index-url --no-emit-trusted-host
appdirs==1.4.4
# via subliminal
babelfish==0.6.0
Expand Down Expand Up @@ -56,9 +52,7 @@ future==0.18.3
gntp==1.0.3
# via sickchill
greenlet==3.0.3
# via
# sickchill
# sqlalchemy
# via sickchill
guessit==3.8.0
# via
# sickchill
Expand Down Expand Up @@ -145,6 +139,8 @@ requests-oauthlib==1.3.1
# via python-twitter
send2trash==1.8.2
# via sickchill
setuptools==74.1.2
# via -r requirements.in
sickchill==2024.3.1
# via -r requirements.in
six==1.16.0
Expand Down Expand Up @@ -181,7 +177,9 @@ tus-py==1.3.4
tvdbsimple==1.0.6
# via sickchill
typing-extensions==4.9.0
# via sqlalchemy
# via
# dogpile-cache
# sqlalchemy
unidecode==1.3.8
# via sickchill
urllib3==2.2.0
Expand Down

0 comments on commit 71c90ae

Please sign in to comment.