Merge pull request 'feat: migrate to UV package manager and enhance production config' (#19) from feature/meetings into main
Reviewed-on: https://gitea.blackbusinesslabs.com/ATTUNE-HEART-THERAPY/alternative-backend-service/pulls/19
This commit is contained in:
commit
7dfcb19547
@ -67,6 +67,9 @@ 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': {
|
||||||
|
|||||||
33
dockerfile
33
dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM python:3.11-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE 1
|
ENV PYTHONDONTWRITEBYTECODE 1
|
||||||
@ -7,24 +7,31 @@ 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 \
|
||||||
gcc \
|
build-essential \
|
||||||
|
curl wget \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy requirements and install Python dependencies
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
COPY requirements.txt .
|
ENV PATH="/root/.local/bin:${PATH}"
|
||||||
RUN pip install --no-cache-dir --upgrade pip
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
# Copy project
|
# Copy only the dependency definitions first to leverage Docker's layer caching
|
||||||
|
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 static files
|
# Collect the static files
|
||||||
RUN python manage.py collectstatic --noinput
|
RUN uv run --no-sync ./manage.py collectstatic --noinput
|
||||||
|
|
||||||
# Expose port
|
# Migrate the database
|
||||||
|
RUN uv run --no-sync ./manage.py migrate
|
||||||
|
|
||||||
|
# Expose the port Gunicorn will run on
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Run migrations and start Gunicorn
|
# Run with gunicorn
|
||||||
CMD sh -c "python manage.py migrate && gunicorn booking_system.wsgi:application --bind 0.0.0.0:8000 --workers 3"
|
CMD ["uv", "run", "--no-sync", "gunicorn", "--bind", "0.0.0.0:8000", "--workers", "3", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "info", "config.wsgi:application"]
|
||||||
Loading…
Reference in New Issue
Block a user