Initial commit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
# ── RV50x Template Manager ─────────────────────────────────────────────────
|
||||
# Uses the official Playwright Python image which has Chromium and all
|
||||
# required system libraries pre-installed — no manual apt installs needed.
|
||||
# ───────────────────────────────────────────────────────────────────────────
|
||||
|
||||
FROM mcr.microsoft.com/playwright/python:v1.44.0-jammy
|
||||
|
||||
# Set working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# ── Install Python dependencies ─────────────────────────────────────────────
|
||||
# Copy requirements first so Docker caches this layer — only rebuilds when
|
||||
# requirements.txt changes, not every time app code changes.
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# ── Install Playwright's Chromium browser ───────────────────────────────────
|
||||
# The base image has the system libs; this installs the actual browser binary.
|
||||
RUN playwright install chromium
|
||||
|
||||
# ── Copy application files ──────────────────────────────────────────────────
|
||||
COPY app.py .
|
||||
COPY index.html .
|
||||
|
||||
# ── Create data directories ─────────────────────────────────────────────────
|
||||
# These will be overridden by volume mounts in docker-compose, but we create
|
||||
# them here so the app works even if volumes aren't configured.
|
||||
RUN mkdir -p /data/template_downloads \
|
||||
/data/template_uploads \
|
||||
/data/xml_templates
|
||||
|
||||
# ── Environment defaults ────────────────────────────────────────────────────
|
||||
# These are overridden by the .env file or docker-compose environment section.
|
||||
ENV DOWNLOAD_DIR=/data/template_downloads
|
||||
ENV UPLOAD_DIR=/data/template_uploads
|
||||
ENV TEMPLATES_DIR=/data/xml_templates
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# ── Expose port ─────────────────────────────────────────────────────────────
|
||||
# Change the left number in docker-compose.yml to remap to a different host port.
|
||||
EXPOSE 8000
|
||||
|
||||
# ── Start the application ───────────────────────────────────────────────────
|
||||
# SSL_CERT and SSL_KEY env vars are optional — if set, uvicorn serves HTTPS.
|
||||
# If not set, falls back to plain HTTP (useful for local dev).
|
||||
CMD ["sh", "-c", "\
|
||||
if [ -n \"$SSL_CERT\" ] && [ -n \"$SSL_KEY\" ]; then \
|
||||
echo 'Starting with HTTPS'; \
|
||||
python -m uvicorn app:app --host 0.0.0.0 --port 8000 \
|
||||
--ssl-certfile \"$SSL_CERT\" --ssl-keyfile \"$SSL_KEY\"; \
|
||||
else \
|
||||
echo 'Starting with HTTP (no SSL vars set)'; \
|
||||
python -m uvicorn app:app --host 0.0.0.0 --port 8000; \
|
||||
fi"]
|
||||
Reference in New Issue
Block a user