Internal
Public Access
Add Docker deployment configuration
- Add Dockerfile for production (multi-stage build) - Add Dockerfile.dev for development with hot reload - Add docker-compose.yml with 5 services (web, mariadb, redis, celery-worker, celery-beat) - Add docker-compose.dev.yml for development overrides - Add .dockerignore for optimized builds - Add docker/entrypoint.sh startup script - Add .env.docker.example template - Add Makefile for common commands - Add deploy.sh for one-command deployment - Update config/settings/selfhosted.py to support MariaDB via DATABASE_URL - Add mysqlclient to requirements.txt for MariaDB support - Update .gitignore to exclude .env.docker 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.5
parent
a2097dcad3
commit
71399e54b8
@@ -0,0 +1,45 @@
|
||||
# ===================================================================
|
||||
# Development Dockerfile - Fast builds with development tools
|
||||
# ===================================================================
|
||||
FROM python:3.12-slim-bookworm
|
||||
|
||||
# Install build and runtime dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
default-libmysqlclient-dev \
|
||||
default-mysql-client \
|
||||
pkg-config \
|
||||
curl \
|
||||
vim \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create django user
|
||||
RUN useradd -m -u 1000 -s /bin/bash django
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install Python dependencies
|
||||
# Note: In dev mode, code is mounted as volume, so we just install deps
|
||||
COPY requirements.txt /tmp/
|
||||
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
|
||||
&& pip install --no-cache-dir mysqlclient gunicorn
|
||||
|
||||
# Create directories
|
||||
RUN mkdir -p /app/media /app/staticfiles && \
|
||||
chown -R django:django /app
|
||||
|
||||
# Switch to django user
|
||||
USER django
|
||||
|
||||
# Set Python to run in unbuffered mode
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Expose port 8000
|
||||
EXPOSE 8000
|
||||
|
||||
# Entrypoint script handles service startup
|
||||
ENTRYPOINT ["/app/docker/entrypoint.sh"]
|
||||
|
||||
# Default command for dev is Django runserver
|
||||
CMD ["runserver"]
|
||||
Reference in New Issue
Block a user