forked from wizarrrr/wizarr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
104 lines (74 loc) · 3.16 KB
/
Dockerfile
File metadata and controls
104 lines (74 loc) · 3.16 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# ─── Stage 1: Dependencies ───────────────────────────────────────────────
FROM ghcr.io/astral-sh/uv:python3.13-alpine AS deps
# Install system dependencies
RUN apk add --no-cache nodejs npm
# Set working directory
WORKDIR /app
# Enable bytecode compilation for faster startup
ENV UV_COMPILE_BYTECODE=1
# Use copy link mode to avoid warnings with cache mounts
ENV UV_LINK_MODE=copy
# Copy dependency files first for better caching
COPY pyproject.toml uv.lock ./
# Install Python dependencies only (not project) with cache mount for speed
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --no-install-project
# Copy npm dependency files and install with cache
COPY app/static/package*.json ./app/static/
RUN npm --prefix app/static/ ci --cache /tmp/npm-cache
# ─── Stage 2: Build assets ────────────────────────────────────────────────
FROM deps AS builder
# Copy source files needed for building
COPY app/ ./app/
COPY babel.cfg ./
# Install the project now that we have source code
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked
# Create directories needed for npm build
RUN mkdir -p app/static/js app/static/css
# Build translations
RUN uv run pybabel compile -d app/translations
# Build static assets
RUN npm --prefix app/static/ run build
# ─── Stage 3: Runtime ─────────────────────────────────────────────────────
FROM python:3.13-alpine
# Set default environment variables for user/group IDs
ENV PUID=1000
ENV PGID=1000
# Install runtime dependencies only
RUN apk add --no-cache curl tzdata su-exec
# Set application working directory
WORKDIR /app
# Copy Python environment from builder stage (includes project)
COPY --from=builder /app/.venv /app/.venv
# Make sure we can run uv in the final image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Copy application code and built assets
COPY --chown=1000:1000 --from=builder /app/app /app/app
COPY --chown=1000:1000 . /app
# Create data directory for database (backward compatibility)
RUN mkdir -p /data/database
# Create wizard steps config directory
RUN mkdir -p /etc/wizarr/wizard_steps
# Create directories that need to be writable
RUN mkdir -p /.cache
ARG APP_VERSION=dev
ENV APP_VERSION=${APP_VERSION}
# Healthcheck: curl to localhost:5690/health
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -fs http://localhost:5690/health || exit 1
# Expose port 5690
EXPOSE 5690
# Copy any wizard steps into /opt
COPY wizard_steps /opt/default_wizard_steps
# Copy entrypoint script and make it executable
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Entrypoint and default CMD
ENTRYPOINT ["docker-entrypoint.sh"]
# By default we run Gunicorn under wizarruser
CMD ["uv", "run", "gunicorn", \
"--config", "gunicorn.conf.py", \
"--bind", "0.0.0.0:5690", \
"--umask", "007", \
"run:app"]