500
Internal server error
Forgejo version: 7.0.1+gitea-1.22.0
diff --git a/cmc-django/.gitignore b/cmc-django/.gitignore new file mode 100644 index 00000000..21e56100 --- /dev/null +++ b/cmc-django/.gitignore @@ -0,0 +1,13 @@ +# Python-generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +lib/ +bin/ + +# Virtual environments +.venv diff --git a/cmc-django/.gitignore~ b/cmc-django/.gitignore~ new file mode 100644 index 00000000..c310698b --- /dev/null +++ b/cmc-django/.gitignore~ @@ -0,0 +1,12 @@ +# Python-generated files +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info + +lib/ + +# Virtual environments +.venv diff --git a/cmc-django/.python-version b/cmc-django/.python-version new file mode 100644 index 00000000..bd28b9c5 --- /dev/null +++ b/cmc-django/.python-version @@ -0,0 +1 @@ +3.9 diff --git a/cmc-django/Dockerfile b/cmc-django/Dockerfile new file mode 100644 index 00000000..831bd931 --- /dev/null +++ b/cmc-django/Dockerfile @@ -0,0 +1,78 @@ +# Stage 1: Base Image and System Dependencies +# ------------------------------------------ +# Use an official Python slim image. These are multi-arch and will pull the arm64 variant on Apple Silicon. +# Choose the Python version matching your project requirement (e.g., 3.11, 3.12). +FROM python:3.11-slim AS base +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ + +# Set environment variables to prevent interactive prompts during package installations +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 +ENV DEBIAN_FRONTEND=noninteractive + +# Install essential system dependencies +# - build-essential: Required for compiling some Python packages with C extensions. +# - pkg-config: Helper tool for finding library compilation flags. +# - default-libmysqlclient-dev: Required for mysqlclient (MySQL/MariaDB adapter). +# (Replaced libpq-dev from previous version). +# - curl: Needed to download the uv installer script. +# Clean up apt cache afterwards to keep the image size down. +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + pkg-config \ + default-libmysqlclient-dev \ + curl \ + clang \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Stage 2: Install uv +# ------------------- +# Install uv using the recommended script. +# RUN curl -LsSf https://astral.sh/uv/install.sh | sh +# Add uv to the PATH +# ENV PATH="/root/.cargo/bin:$PATH" + +# Stage 3: Application Setup +# -------------------------- +# Set the working directory inside the container +WORKDIR /app + +# Copy dependency file(s) +# Ensure requirements.txt includes Django and all other necessary packages. +# COPY requirements.txt requirements.txt +# If you use pyproject.toml for dependencies primarily, copy it instead or as well: +COPY pyproject.toml pyproject.toml + +# Install Python dependencies using uv from requirements.txt +# --system: Install packages into the system Python environment within the container (common for Docker) +# --no-cache: Avoid caching downloads/builds within this layer to keep it smaller +# RUN uv pip install --system --no-cache-dir -r requirements.txt + +# NOTE: Removed the 'uv pip install .' command below as it caused the +# "Multiple top-level packages discovered" error. We typically only need +# to install dependencies from requirements.txt for running a Django app in Docker. +# Ensure your requirements.txt is complete. +# ----------------------------------------------------------------------------- +# Or if using pyproject.toml (ensure it defines dependencies correctly): + +ENV UV_LINK_MODE=copy +RUN uv pip install --system --no-cache-dir . +# ----------------------------------------------------------------------------- + + +# Copy the rest of the application code into the container +COPY . . + +# Collect static files +RUN uv run python cmcsales/manage.py collectstatic --noinput + +# Expose the port the Django app runs on (adjust if you use a different port) +EXPOSE 8000 + + +# Default command to run the application +# This is often overridden by docker-compose.yml, but it's good practice to have a default. +# Replace '
Internal server error
Forgejo version: 7.0.1+gitea-1.22.0