-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Dockerfile
70 lines (56 loc) · 1.52 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Builder Image for Python Dependencies
FROM python:3.11-alpine AS builder
# Install necessary build dependencies
RUN apk add --no-cache \
gcc \
musl-dev \
libffi-dev \
python3-dev \
build-base \
curl
# Upgrade pip and install poetry
RUN pip install --upgrade pip && pip install poetry==1.8.3
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN touch README.md
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR
# Final Image
FROM python:3.11-alpine
LABEL name="Riven" \
description="Riven Media Server" \
url="https://github.com/rivenmedia/riven"
# Install system dependencies and Node.js
ENV PYTHONUNBUFFERED=1
RUN apk add --no-cache \
curl \
shadow \
rclone \
unzip \
gcc \
musl-dev \
libffi-dev \
python3-dev \
libpq-dev \
libtorrent
# Install Poetry
RUN pip install poetry==1.8.3
# Set environment variable to force color output
ENV FORCE_COLOR=1
ENV TERM=xterm-256color
# Set working directory
WORKDIR /riven
# Copy the virtual environment from the builder stage
COPY --from=builder /app/.venv /app/.venv
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:$PATH"
# Copy the rest of the application code
COPY src/ /riven/src
COPY pyproject.toml poetry.lock /riven/
COPY entrypoint.sh /riven/
# Ensure entrypoint script is executable
RUN chmod +x /riven/entrypoint.sh
ENTRYPOINT ["/riven/entrypoint.sh"]