This GitHub repository contains three complete guides on how to containerize a Django application using Docker. Each guide lives in its own branch, showing a different strategy for building and running Django inside containers.
| Branch | Approach | Description |
|---|---|---|
Creating-Docker-image-from-Dockerfile |
Basic Docker Setup | Build a Django image from a single Dockerfile β covers fundamentals and best practices |
Docker-Compose |
Docker Compose | Full multi-service setup (Django + Database + postgresql) with orchestration using Docker Compose |
Multi-stage-Build-Docker |
Multi-stage Build | Production-optimized image with separate build and runtime stages |
-
Clone the repository:
git clone https://github.com/GhilaniYassine/Django-Docker-Deployment..git cd Django-Docker-Deployment. -
Choose your approach:
# For Docker Compose approach git checkout Docker-Compose # For Multi-stage build git checkout Multi-stage-Build-Docker # For advanced Dockerfile approach git checkout Creating-Docker-image-from-Dockerfile
-
Follow the instructions in each branch's README for specific setup steps
- Basic Containerization: Environment variables, port mapping, and Docker basics
- Advanced Dockerfile Techniques: Layer optimization, multi-stage builds, and security best practices
- Orchestration: Managing multiple services with Docker Compose
- Production Deployment: Optimized builds for production environments