initialize docker build
This commit is contained in:
parent
2e49849960
commit
c2c5b62a63
4 changed files with 121 additions and 0 deletions
50
docker/Caddyfile
Normal file
50
docker/Caddyfile
Normal file
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
auto_https off
|
||||
http_port 8080
|
||||
https_port 0
|
||||
cert_issuer internal
|
||||
skip_install_trust
|
||||
|
||||
log {
|
||||
output stderr
|
||||
format console
|
||||
level INFO
|
||||
}
|
||||
|
||||
servers {
|
||||
protocols h1
|
||||
}
|
||||
|
||||
storage file_system {
|
||||
root /app/run/caddy
|
||||
}
|
||||
}
|
||||
|
||||
:8080 {
|
||||
# Health check endpoint
|
||||
handle /healthz {
|
||||
respond "OK" 200
|
||||
}
|
||||
|
||||
# Handle static files
|
||||
handle /static/* {
|
||||
uri strip_prefix /static
|
||||
root * /app/staticfiles
|
||||
file_server
|
||||
}
|
||||
|
||||
# Handle media files
|
||||
handle /media/* {
|
||||
uri strip_prefix /media
|
||||
root * /data/media
|
||||
file_server
|
||||
}
|
||||
|
||||
# Proxy all other requests to Gunicorn
|
||||
handle {
|
||||
reverse_proxy unix//app/run/gunicorn.sock
|
||||
}
|
||||
|
||||
# Basic compression for better performance
|
||||
encode gzip
|
||||
}
|
24
docker/run.sh
Normal file
24
docker/run.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Create required directories with appropriate permissions
|
||||
mkdir -p /app/run/caddy /app/run/gunicorn
|
||||
|
||||
# Set Caddy config location
|
||||
export XDG_CONFIG_HOME="/app/config"
|
||||
|
||||
echo "Applying database migrations"
|
||||
uv run src/manage.py migrate
|
||||
|
||||
echo "Starting Caddy"
|
||||
exec caddy run --config /app/config/caddy/Caddyfile --adapter caddyfile 2>&1 &
|
||||
|
||||
echo "Starting Gunicorn"
|
||||
exec \
|
||||
gunicorn \
|
||||
-w 4 \
|
||||
--access-logfile - \
|
||||
--error-log - \
|
||||
--capture-output \
|
||||
--pythonpath /app/.venv/lib/python3.13/site-packages/ \
|
||||
--bind unix:/app/run/gunicorn.sock \
|
||||
servala.wsgi:application
|
Loading…
Add table
Add a link
Reference in a new issue