-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
88 lines (69 loc) · 2.53 KB
/
Dockerfile
File metadata and controls
88 lines (69 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# syntax=docker/dockerfile:1.4
FROM node:lts-alpine AS node_builder
WORKDIR /app
COPY frontend ./
ENV NODE_ENV=production
RUN if [ ! -f "/app/exported/index.html" ]; then \
npm install -g pnpm && \
NODE_ENV=production pnpm install --frozen-lockfile --prod --ignore-scripts && \
pnpm run generate; \
else echo "Skipping UI build, already built."; fi
FROM python:3.13-bookworm AS python_builder
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1
ENV PIP_NO_CACHE_DIR=off
ENV PIP_CACHE_DIR=/root/.cache/pip
ENV UV_CACHE_DIR=/root/.cache/uv
ENV DEBIAN_FRONTEND=noninteractive
ENV UV_INSTALL_DIR=/usr/bin
COPY --from=astral/uv:latest /uv /usr/bin/
WORKDIR /opt/
COPY ./pyproject.toml ./uv.lock ./
RUN --mount=type=cache,target=/root/.cache/pip,id=pip-cache \
--mount=type=cache,target=/root/.cache/uv,id=uv-cache \
uv venv --system-site-packages --relocatable ./python && \
VIRTUAL_ENV=/opt/python uv sync --no-dev --link-mode=copy --active
FROM python:3.13-slim
ARG TZ=UTC
ARG USER_ID=1000
ENV IN_CONTAINER=1
ENV UMASK=0002
ENV FBC_CONFIG_PATH=/config
ENV FBC_STORAGE_PATH=/downloads
ENV FBC_FRONTEND_EXPORT_PATH=/app/frontend/exported
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1
ENV FBC_DEV_MODE=0
ENV PYTHONUTF8=1
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends locales libmagic1 && \
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8 && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /config /downloads && ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone && \
useradd -u ${USER_ID:-1000} -U -d /app -s /bin/bash app && \
chown -R app:app /config /downloads
COPY --chown=app:app ./alembic.ini /app/alembic.ini
COPY --chown=app:app ./backend /app/backend
COPY --chown=app:app --from=node_builder /app/exported /app/frontend/exported
COPY --chown=app:app --from=python_builder /opt/python /opt/python
COPY --from=ghcr.io/arabcoders/jellyfin-ffmpeg /usr/bin/ffmpeg /usr/bin/ffmpeg
COPY --from=ghcr.io/arabcoders/jellyfin-ffmpeg /usr/bin/ffprobe /usr/bin/ffprobe
# Install fbc CLI script
COPY ./backend/bin/fbc /usr/bin/fbc
RUN chmod +x /usr/bin/fbc
ENV PATH="/opt/python/bin:$PATH"
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
VOLUME /config
VOLUME /downloads
EXPOSE 8000
USER app
WORKDIR /tmp
CMD ["/opt/python/bin/python", "/app/backend/main.py"]