Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 1.86 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (49 loc) · 1.86 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
# ===========================================
# Stage 1: Builder - Install dependencies and build the project
# ===========================================
FROM python:3.13-slim-trixie AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Set working directory
WORKDIR /app
# Set environment variables for uv optimization
ENV UV_CACHE_DIR=/opt/uv-cache
ENV UV_PYTHON_CACHE_DIR=/opt/uv-cache/python
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Copy dependency files first for better layer caching
COPY pyproject.toml uv.lock ./
# Install dependencies
RUN --mount=type=cache,target=/opt/uv-cache \
uv sync --locked --no-install-project --no-editable --no-dev
# Copy source code
COPY . .
# Install the project in non-editable mode for production
RUN --mount=type=cache,target=/opt/uv-cache \
uv sync --locked --no-editable --no-dev
# ===========================================
# Stage 2: Runtime - Minimal Python slim image
# ===========================================
FROM python:3.13-slim-trixie
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
sox flac mp3val curl nano vim rclone \
ca-certificates lame \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Copy the virtual environment from builder stage
COPY --from=builder /app/.venv /app/.venv
# Set environment variables for Python virtual environment
ENV PATH="/app/.venv/bin:$PATH"
# Ensure app directory and its contents are writable by any user
RUN mkdir -p /app/.music /app/.torrents && chmod -R 777 /app
# Expose port for web interface
EXPOSE 55110
# Set the entrypoint to run the 'salmon' script
ENTRYPOINT ["salmon"]