Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jifollan authored and GitHub Enterprise committed Mar 3, 2025
1 parent 4ad4019 commit 8ded3d2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# We Use an official Python runtime as a parent image
# Use an official Python runtime as a parent image
FROM python:3.12-slim

# Allows docker to cache installed dependencies between builds
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Set environment variables for better Python handling
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

# Mounts the application code to the image
COPY . app
# Install dependencies
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt

# Set the working directory in the container
WORKDIR /app

# Copy the application code to the image
COPY . .

# Expose the port that the app will run on
EXPOSE 8000

# Runs migrations and starts the production server
CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"]
# Run migrations and start the server
CMD ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"]

0 comments on commit 8ded3d2

Please sign in to comment.