social-network
1.4K
This is the official image for the Social Network application, a web application built with Django (Python). The image was built in an optimized way using python:3.13-alpine, ensuring it is lightweight and secure, making it ideal for production environments.
The image packages all the application code and its dependencies, ready for execution. It is configured with Docker best practices:
entrypoint.sh script (responsible for migrations and starting the WSGI/ASGI server).8000.duser), ensuring greater security.Since the application requires a relational database (PostgreSQL), the easiest and recommended way to start the services is by using Docker Compose.
Create a docker-compose.yml file and add the following content:
services:
db:
image: postgres:17
volumes:
- db_socialnet:/var/lib/postgresql/data
env_file:
- .env
networks:
- socialnet-network
web:
image: rafaelrodriguess/social-network:latest
ports:
- "8000:8000"
volumes:
- static_volume:/data/web/static
- media_volume:/data/web/media
env_file:
- .env
networks:
- socialnet-network
depends_on:
- db
networks:
socialnet-network:
volumes:
db_socialnet:
static_volume:
media_volume:
.env)The image is highly configurable through environment variables. Create a .env file in the same folder as your docker-compose.yml with the following configuration:
# Django Configurations
SECRET_KEY="your-super-secure-secret-key"
DEBUG=0
ALLOWED_HOSTS=127.0.0.1,localhost,your-domain.com
CSRF_TRUSTED_ORIGINS=http://localhost,https://your-domain.com
PER_PAGE=10
# Database Configurations (PostgreSQL)
POSTGRES_DB="socialnet_db"
POSTGRES_USER="postgres_user"
POSTGRES_PASSWORD="postgres_password"
POSTGRES_HOST="db" # Database service name in docker-compose
POSTGRES_PORT="5432"
# S3 Storage Credentials (e.g. Supabase) for Media
SUPABASE_STORAGE_BUCKET_NAME="your-bucket"
SUPABASE_ACCESS_KEY_ID="your-access-key"
SUPABASE_SECRET_ACCESS_KEY="your-secret-key"
SUPABASE_ENDPOINT_URL="your-endpoint-url"
The image uses specific directories to persist volatile data. It is highly recommended to map them to named volumes (as shown in the Docker Compose example):
/data/web/static: Collected static files from the application (CSS, JS, fonts)./data/web/media: Media files uploaded by users in the system.This image was designed for production:
PYTHONDONTWRITEBYTECODE=1 and PYTHONUNBUFFERED=1 are enabled by default to ensure logs are output quickly and temporary files do not pollute the container.Developed by Rafael Rodrigues.
Content type
Image
Digest
sha256:8719074f1…
Size
89 MB
Last updated
1 day ago
docker pull rafaelrodriguess/social-network