Add Docker support with Dockerfile and entrypoin

This commit is contained in:
krek0 2026-05-03 16:54:46 +02:00
parent 75296c903a
commit 0e1b1f5a35
9 changed files with 208 additions and 2 deletions

View file

@ -66,6 +66,78 @@ run and to maintain.
```./maintenance_tool.sh```
## Docker install
1. Create a `docker-compose.yml` (a ready-to-use file is provided in the repository):
```yaml
version: "3.9"
networks:
photo26:
services:
db:
image: postgres:16
container_name: photo26-db
restart: unless-stopped
environment:
POSTGRES_DB: photo26
POSTGRES_USER: photo26
POSTGRES_PASSWORD: change-me
volumes:
- ./postgres_data:/var/lib/postgresql/data
networks:
- photo26
photo26:
image: git.sinfonie.org/sinfonie/photo26:latest
container_name: photo26-app
restart: unless-stopped
depends_on:
- db
environment:
DB_ENGINE: postgres
DB_NAME: photo26
DB_USER: photo26
DB_PASSWORD: change-me
DB_HOST: db
DB_PORT: 5432
SECRET_KEY: change-me
EXTRA_HOSTS: photos.example.org
volumes:
- ./media:/app/media
ports:
- "8080:8000"
networks:
- photo26
```
2. Start the stack:
```bash
docker compose up -d
```
On first start the container will run migrations and create a default admin account automatically.
3. **Default credentials** — change these immediately after first login:
| Field | Value |
|----------|-----------------|
| Username | `admin` |
| Password | `admin` |
| Email | `admin@localhost` |
Admin panel: `http://localhost:8080/admin/`
4. **Passwords to change** in `docker-compose.yml` before going to production:
- `POSTGRES_PASSWORD` / `DB_PASSWORD` — database password
- `SECRET_KEY` — Django secret key (use a long random string)
- Log in to the admin panel and change the `admin` user password
---
6. *Enjoy \o/*
In development, you can launch the development server using: