-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDockerfile
More file actions
131 lines (107 loc) · 4.13 KB
/
Copy pathDockerfile
File metadata and controls
131 lines (107 loc) · 4.13 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# ---- Frontend builder (temporary) ----
FROM --platform=$BUILDPLATFORM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy frontend files and install dependencies
COPY webui/frontend/package*.json ./
RUN npm install --force
COPY webui/frontend/ ./
RUN npm run build
# ---- Final runtime image ----
FROM python:3.13-alpine
ARG TARGETARCH
ARG VENDOR
ARG VERSION
ENV APP_VERSION=$VERSION \
TZ="Europe/Berlin" \
POWERSHELL_DISTRIBUTION_CHANNEL="PSDocker" \
FONTS_GID=5555 \
POSTERIZARR_NON_ROOT="TRUE" \
APP_ROOT="/app" \
APP_DATA="/config" \
FONTCONFIG_CACHE_DIR="/var/cache/fontconfig" \
PSMODULE_ANALYSIS_CACHE_ENABLED="false" \
XDG_DATA_HOME="/usr/local/share/powershell" \
XDG_CACHE_HOME="/usr/local/share/powershell" \
UMASK="0002"
# Install runtime dependencies + PowerShell + ImageMagick
RUN echo @edge http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
&& echo @edge http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
&& apk upgrade --update-cache --available \
&& apk add --no-cache \
catatonit \
curl \
fontconfig \
libjpeg-turbo \
imagemagick@edge \
imagemagick-libs@edge \
imagemagick-heic \
imagemagick-jpeg \
imagemagick-webp@edge \
libwebp \
libwebp-tools \
librsvg@edge \
powershell \
tzdata \
bash \
shadow \
git \
&& pwsh -NoProfile -Command " \
Register-PSRepository -Default; \
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -ErrorAction Stop; \
Install-Module -Name FanartTvAPI -Scope AllUsers -Force -ErrorAction Stop; \
if (!(Test-Path (Split-Path \$PROFILE.AllUsersAllHosts))) { New-Item -ItemType Directory -Force (Split-Path \$PROFILE.AllUsersAllHosts) }; \
'Set-PSReadLineOption -HistorySaveStyle SaveNothing' | Out-File -FilePath \$PROFILE.AllUsersAllHosts -Encoding utf8" \
&& mkdir -p /app /usr/share/fonts/custom /var/cache/fontconfig \
&& chmod -R 755 /app /usr/local/share/powershell \
&& chmod -R 777 /usr/share/fonts/custom /var/cache/fontconfig
# Copy backend requirements file first to leverage Docker cache
COPY webui/backend/requirements.txt /app/requirements.txt
# Set up Python dependencies for FastAPI backend
RUN apk add --no-cache --virtual .build-deps build-base python3-dev linux-headers \
&& pip install --no-cache-dir -r /app/requirements.txt apprise \
&& apk del .build-deps
# Copy Posterizarr main app
COPY . /app
# Copy backend
COPY webui/backend/ /app/backend/
# Copy built frontend
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
# Create necessary directories
RUN mkdir -p /app/Logs /app/assets /app/temp
# ---- Combined startup script ----
COPY <<'EOF' /app/start.sh
#!/bin/sh
set -e
export PYTHONPATH=/app
# Use APP_PORT environment variable, or default to 8000
INTERNAL_PORT=${APP_PORT:-8000}
# Check if the UI should be started (case-insensitive check)
case "$DISABLE_UI" in
[Tt][Rr][Uu][Ee])
# Matches "true", "TRUE", "True", "TrUe", etc.
echo "DISABLE_UI=true detected. Skipping Web UI startup."
;;
*)
# Default case: Runs if DISABLE_UI is "false", empty, or not set
echo "Starting FastAPI Web UI (API + Frontend) on port ${INTERNAL_PORT}..."
python -m uvicorn backend.main:app --host 0.0.0.0 --port ${INTERNAL_PORT} --log-level critical --no-access-log &
;;
esac
# Start Posterizarr PowerShell automation
echo "Starting Posterizarr PowerShell automation..."
exec /usr/bin/catatonit -- pwsh -NoProfile /app/Start.ps1
EOF
RUN chmod +x /app/start.sh
# Set working directory and permissions
WORKDIR /config
USER nobody:nogroup
VOLUME ["/config"]
ARG VERSION
# Labels
LABEL org.opencontainers.image.source="https://github.com/fscorrupt/posterizarr"
LABEL org.opencontainers.image.description="Posterizarr - Automated poster generation with integrated Web UI"
LABEL org.opencontainers.image.licenses="GPL-3.0"
LABEL org.opencontainers.image.version=$VERSION
# Expose backend + frontend ports
EXPOSE 8000
ENTRYPOINT ["/app/start.sh"]