Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . /app/backend

EXPOSE 8000
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Automate migrations via an entrypoint script
Relying on commented-out migration commands can lead to drift between code and schema. Consider adding an entrypoint.sh that runs migrations before starting the server, then switch from CMD to ENTRYPOINT. For example:

COPY entrypoint.sh /app/backend/
RUN chmod +x /app/backend/entrypoint.sh
ENTRYPOINT ["/app/backend/entrypoint.sh"]
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]

Where entrypoint.sh contains:

#!/bin/sh
python3 manage.py migrate --noinput
exec "$@"

#RUN python manage.py migrate
#RUN python manage.py makemigrations