Fix os import and add media settings 4
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -18,5 +18,14 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
# Копируем весь проект в контейнер
|
# Копируем весь проект в контейнер
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Команда для запуска (пока простая)
|
# ... (твои предыдущие шаги: FROM, WORKDIR, COPY) ...
|
||||||
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
|
||||||
|
# Копируем скрипт и даем ему права на выполнение
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
# Указываем скрипт как точку входа
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
# Команда по умолчанию (которую подхватит exec "$@" в скрипте)
|
||||||
|
CMD ["gunicorn", "core.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"]
|
||||||
9
entrypoint.sh
Normal file
9
entrypoint.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Собираем статику
|
||||||
|
echo "Collecting static files..."
|
||||||
|
python manage.py collectstatic --noinput
|
||||||
|
|
||||||
|
# Запускаем основную команду (Gunicorn)
|
||||||
|
echo "Starting Gunicorn..."
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user