35 lines
814 B
Docker
35 lines
814 B
Docker
# Use an official Python runtime as a parent image
|
|
FROM python:3.11-slim-bookworm
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
libpq-dev \
|
|
default-libmysqlclient-dev \
|
|
pkg-config \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt /app/
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
RUN pip install gunicorn
|
|
|
|
# Copy project files
|
|
COPY . /app/
|
|
|
|
# Expose the port on which the application will run
|
|
EXPOSE 3030
|
|
|
|
# Define environment variable for Gunicorn
|
|
ENV GUNICORN_CMD_ARGS="--bind 0.0.0.0:3030"
|
|
|
|
# Run Gunicorn server with your Django application
|
|
CMD ["gunicorn", "BH.wsgi:application"]
|