36 lines
963 B
Docker
36 lines
963 B
Docker
# Simple Blog — single-container image
|
|
# Built from this directory. No external services required.
|
|
FROM python:3.11-slim
|
|
|
|
# Keep Python warnings out of stdout/stderr
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies first (better layer caching)
|
|
COPY requirements.txt .
|
|
RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
|
|
# Copy the application
|
|
COPY blog/ ./blog/
|
|
COPY templates/ ./templates/
|
|
COPY static/ ./static/
|
|
COPY run.py ./
|
|
|
|
# Create the data directory for the SQLite database
|
|
RUN mkdir -p /app/data
|
|
|
|
# The app listens on all interfaces on port 5000
|
|
EXPOSE 5000
|
|
|
|
# Default environment (override with -e or docker-compose). No password or
|
|
# session secret is baked in: without them the app generates strong ones on
|
|
# first boot (the temporary password is printed once to the logs).
|
|
ENV PORT=5000 \
|
|
BLOG_DATA_DIR=/app/data
|
|
|
|
# Run the application
|
|
CMD ["python", "run.py"]
|