Compare commits

..

No commits in common. "7dfcb19547ce61eb0557bc7dc5dc8baa22e1a400" and "fb54b4e120c8c584b48d7152cea5ca4efd5206ea" have entirely different histories.

2 changed files with 13 additions and 23 deletions

View File

@ -67,9 +67,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'booking_system.wsgi.application' WSGI_APPLICATION = 'booking_system.wsgi.application'
if not DEBUG:
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
# DATABASES = { # DATABASES = {
# 'default': { # 'default': {

View File

@ -1,4 +1,4 @@
FROM debian:bookworm-slim FROM python:3.11-slim
# Set environment variables # Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONDONTWRITEBYTECODE 1
@ -7,31 +7,24 @@ ENV PYTHONUNBUFFERED 1
# Set work directory # Set work directory
WORKDIR /app WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
build-essential \ gcc \
curl wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN curl -LsSf https://astral.sh/uv/install.sh | sh # Copy requirements and install Python dependencies
ENV PATH="/root/.local/bin:${PATH}" COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy only the dependency definitions first to leverage Docker's layer caching # Copy project
COPY pyproject.toml uv.lock .python-version ./
# Install Python dependencies for production
RUN uv sync --no-group dev --group prod
# Copy the rest of the application code into the container
COPY . . COPY . .
# Collect the static files # Collect static files
RUN uv run --no-sync ./manage.py collectstatic --noinput RUN python manage.py collectstatic --noinput
# Migrate the database # Expose port
RUN uv run --no-sync ./manage.py migrate
# Expose the port Gunicorn will run on
EXPOSE 8000 EXPOSE 8000
# Run with gunicorn # Run migrations and start Gunicorn
CMD ["uv", "run", "--no-sync", "gunicorn", "--bind", "0.0.0.0:8000", "--workers", "3", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "info", "config.wsgi:application"] CMD sh -c "python manage.py migrate && gunicorn booking_system.wsgi:application --bind 0.0.0.0:8000 --workers 3"