-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (34 loc) · 1.24 KB
/
Dockerfile
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
# Stage 1: Build stage
FROM python:3.12.7-slim-bookworm AS build
LABEL authors="Teknicallity"
ENV PYTHONUNBUFFERED=1
RUN apt-get -y update && apt-get -y install build-essential
WORKDIR /build
COPY requirements.txt requirements.txt
RUN python -m venv /build/.venv && \
/build/.venv/bin/pip install --upgrade pip wheel --no-cache-dir && \
/build/.venv/bin/pip install --no-cache-dir -r requirements.txt && \
/build/.venv/bin/pip install --no-cache-dir 'uWSGI>=2.0.28'
COPY . .
RUN mkdir -p /build/config
RUN /build/.venv/bin/python manage.py migrate
RUN /build/.venv/bin/python manage.py collectstatic --noinput
# Stage 2: Runtime stage
FROM python:3.12.7-slim-bookworm AS runtime
LABEL authors="Teknicallity"
ENV PYTHONUNBUFFERED=1
WORKDIR /etc/tubarr
VOLUME /etc/tubarr/config
VOLUME /etc/tubarr/media
COPY --from=build /build/.venv /etc/tubarr/.venv
COPY --from=build /build/static /etc/tubarr/static
COPY . .
ENV VIRTUAL_ENV=/etc/tubarr/.venv
ENV PATH=/etc/tubarr/.venv/bin:$PATH
RUN /etc/tubarr/.venv/bin/python3 -m pip install 'supervisor>=4.2.5'
RUN mkdir -p /etc/tubarr/config && \
chown www-data:www-data /etc/tubarr/config && \
chmod g+w /etc/tubarr && \
chmod +x /etc/tubarr/start.sh
EXPOSE 3020
CMD ["/etc/tubarr/start.sh"]