diff --git a/.gitignore b/.gitignore index 8881c4d..0c7bbb9 100644 --- a/.gitignore +++ b/.gitignore @@ -133,3 +133,5 @@ dmypy.json # database *.sqlite3 +static/ +media/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 09fad0b..b5f229f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,11 +10,12 @@ COPY src/requirments.txt . # Install dependencies RUN pip install -r requirments.txt +RUN pip install gunicorn # Copy the application code -COPY src/* . - +COPY src/ . # Expose the port for Gunicorn EXPOSE 8000 # Run migrations and then start Gunicorn -CMD ["sh", "-c", "python manage.py migrate && gunicorn --workers=3 --bind=0.0.0.0:8000 core.wsgi:application"] \ No newline at end of file +# CMD ["sh", "-c", "python manage.py migrate && gunicorn --workers=3 --bind=0.0.0.0:8000 core.wsgi:application"] +ENTRYPOINT [ "sh","/app/docker-entrypoint.sh" ] \ No newline at end of file diff --git a/src/core/settings.py b/src/core/settings.py index bfaae96..02d697a 100644 --- a/src/core/settings.py +++ b/src/core/settings.py @@ -130,7 +130,7 @@ # https://docs.djangoproject.com/en/5.1/howto/static-files/ STATIC_URL = 'static/' - +STATIC_ROOT= 'static/' # Default primary key field type # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field diff --git a/src/docker-entrypoint.sh b/src/docker-entrypoint.sh new file mode 100755 index 0000000..f9d8117 --- /dev/null +++ b/src/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!ash +python manage.py collectstatic --noinput +python manage.py migrate +gunicorn --workers=3 --bind=0.0.0.0:8000 core.wsgi:application \ No newline at end of file