bmc_hub/Dockerfile
Christian 23f8a3d2ae Fix watchfiles spam and port conflicts
- Disabled auto-reload by default (ENABLE_RELOAD=false)
- Changed default ports: PostgreSQL 5433, API 8001
- Updated psycopg2-binary to 2.9.10 (Python 3.13 compat)
- Updated Pydantic to 2.10.3 (Python 3.13 compat)
- Added reload_excludes to prevent .git watching
- Updated .env.example with new defaults
2025-12-05 14:42:18 +01:00

48 lines
1.4 KiB
Docker

FROM python:3.13-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Build arguments for GitHub release deployment
ARG RELEASE_VERSION=latest
ARG GITHUB_TOKEN
ARG GITHUB_REPO=ct/bmc_hub
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# If RELEASE_VERSION is set and not "latest", pull from GitHub release
# Otherwise, copy local files
RUN if [ "$RELEASE_VERSION" != "latest" ] && [ -n "$GITHUB_TOKEN" ]; then \
echo "Downloading release ${RELEASE_VERSION} from GitHub..." && \
curl -H "Authorization: token ${GITHUB_TOKEN}" \
-L "https://g.bmcnetworks.dk/api/v1/repos/${GITHUB_REPO}/archive/${RELEASE_VERSION}.tar.gz" \
-o /tmp/release.tar.gz && \
tar -xzf /tmp/release.tar.gz --strip-components=1 -C /app && \
rm /tmp/release.tar.gz; \
fi
# Copy application code (only used if not downloading from GitHub)
COPY . .
# Create necessary directories
RUN mkdir -p /app/logs /app/uploads /app/static /app/data
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=40s \
CMD curl -f http://localhost:8000/health || exit 1
# Run application
CMD ["python", "main.py"]