- django.registry.Dockerfile: imagen autocontenida (codigo + entrypoint) - docker/entrypoint.sh: migrate + collectstatic + gunicorn; con args ejecuta ese comando - scripts/build-push-image.sh: build y push a gitea.onecluster.org/oneteam/don_confiao_backend (latest + git sha)
23 lines
683 B
Bash
Executable File
23 lines
683 B
Bash
Executable File
#!/bin/sh
|
|
# Entrypoint de la imagen de produccion del backend.
|
|
#
|
|
# Sin argumentos: aplica migraciones, colecta estaticos y arranca gunicorn.
|
|
# Con argumentos: ejecuta ese comando tal cual (util para operaciones, p. ej.
|
|
# docker run --rm <imagen> python manage.py createsuperuser).
|
|
set -e
|
|
|
|
if [ "$#" -gt 0 ]; then
|
|
exec "$@"
|
|
fi
|
|
|
|
echo "[entrypoint] Aplicando migraciones..."
|
|
python manage.py migrate --noinput
|
|
|
|
echo "[entrypoint] Colectando estaticos..."
|
|
python manage.py collectstatic --noinput
|
|
|
|
echo "[entrypoint] Arrancando gunicorn en 0.0.0.0:8000..."
|
|
exec gunicorn config.wsgi:application \
|
|
--bind 0.0.0.0:8000 \
|
|
--workers "${GUNICORN_WORKERS:-4}" \
|
|
--timeout 120 |