Commit
·
6b0a494
1
Parent(s):
7ce12d5
build: make inswapper_128.onnx preload optional via INSWAPPER_URL; set INSIGHTFACE_HOME and INSWAPPER_PATH envs
Browse files- Dockerfile +11 -6
Dockerfile
CHANGED
|
@@ -109,12 +109,17 @@ RUN mkdir -p /app/uploads/source_images /app/uploads/target_videos /app/uploads/
|
|
| 109 |
# Ensure model cache directory is writable for runtime model downloads
|
| 110 |
RUN mkdir -p /app/.assets/models && chown -R user:user /app/.assets
|
| 111 |
|
| 112 |
-
#
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
chown -R user:user /home/user/.insightface
|
| 119 |
|
| 120 |
# Switch to user (upload directories already created with proper permissions)
|
|
|
|
| 109 |
# Ensure model cache directory is writable for runtime model downloads
|
| 110 |
RUN mkdir -p /app/.assets/models && chown -R user:user /app/.assets
|
| 111 |
|
| 112 |
+
# Optional preload of InsightFace inswapper_128.onnx (skips if no URL provided)
|
| 113 |
+
ARG INSWAPPER_URL=""
|
| 114 |
+
ENV INSIGHTFACE_HOME="/home/user/.insightface"
|
| 115 |
+
ENV INSWAPPER_PATH="/home/user/.insightface/models/inswapper_128.onnx"
|
| 116 |
+
RUN set -e; mkdir -p /home/user/.insightface/models; \
|
| 117 |
+
if [ -n "$INSWAPPER_URL" ]; then \
|
| 118 |
+
echo "Downloading inswapper_128.onnx from $INSWAPPER_URL"; \
|
| 119 |
+
curl -fsSL "$INSWAPPER_URL" -o "$INSWAPPER_PATH" || echo "Warning: download failed, continuing without preloaded model"; \
|
| 120 |
+
else \
|
| 121 |
+
echo "No INSWAPPER_URL provided; skipping model download"; \
|
| 122 |
+
fi; \
|
| 123 |
chown -R user:user /home/user/.insightface
|
| 124 |
|
| 125 |
# Switch to user (upload directories already created with proper permissions)
|