Files
product-slip/Dockerfile
diaco 298a4f9643 Add optional apt/PyPI mirrors and HTTP_PORT (#14)
Co-authored-by: Cursor <cursoragent@cursor.com>
Reviewed-on: #14
Co-authored-by: diaco <dyaco8464@yahoo.com>
Co-committed-by: diaco <dyaco8464@yahoo.com>
2026-10-05 05:55:51 +00:00

44 lines
1.2 KiB
Docker

FROM python:3.14-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ARG APT_MIRROR=
ARG PIP_INDEX_URL=
ARG PIP_TRUSTED_HOST=
# Optional Debian apt mirror (host only, e.g. mirror.example.com)
RUN if [ -n "$APT_MIRROR" ]; then \
if [ -f /etc/apt/sources.list.d/debian.sources ]; then \
sed -i "s|deb.debian.org|${APT_MIRROR}|g; s|security.debian.org|${APT_MIRROR}|g" \
/etc/apt/sources.list.d/debian.sources; \
fi; \
if [ -f /etc/apt/sources.list ]; then \
sed -i "s|deb.debian.org|${APT_MIRROR}|g; s|security.debian.org|${APT_MIRROR}|g" \
/etc/apt/sources.list; \
fi; \
fi
# Optional PyPI mirror (pip reads these env vars)
ENV PIP_INDEX_URL=${PIP_INDEX_URL}
ENV PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project
COPY . .
# Collect static files
RUN python manage.py collectstatic --noinput
# Create data directory for SQLite
RUN mkdir -p /app/data
EXPOSE 8000
CMD ["sh", "-c", "python manage.py migrate --noinput && python manage.py seed_products --skip-existing && gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers 2 --timeout 120"]