beaverhabits-caldav-bridge/Dockerfile
2025-05-03 17:22:28 -04:00

38 lines
No EOL
1.4 KiB
Docker

# ┌────────────────────────── build stage ──────────────────────────┐
FROM python:3.11-slim as builder
WORKDIR /app
# install build deps if any (none here), copy requirements
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# └────────────────────────── final stage ──────────────────────────┘
FROM python:3.11-slim
WORKDIR /app
# copy only installed packages from builder (local pip cache)
COPY --from=builder /usr/local/lib/python3.11/site-packages \
/usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# copy app code
COPY app.py .
# expose port
EXPOSE 8000
# default ENV (you can override these in your orchestrator)
ENV BEAVERHABITS_URL="http://beaverhabits.lan" \
BEAVERHABITS_USERNAME="changeme" \
BEAVERHABITS_PASSWORD="changeme"
# use a non-root user if you like; for brevity we run as root.
# run via Gunicorn WSGI server with 4 workers
CMD ["gunicorn", "app:app", \
"--bind", "0.0.0.0:8000", \
"--workers", "4", \
"--threads", "4", \
"--access-logfile", "-", \
"--error-logfile", "-"]