Environment methods

This commit is contained in:
2025-08-23 19:01:36 +01:00
parent cba9d1e341
commit 2a85845835
146 changed files with 370 additions and 383 deletions
+23 -27
View File
@@ -1,38 +1,34 @@
# Example Dockerfile showing how to use the new startup system
# This is a reference - not meant to replace your existing Dockerfile
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libreoffice \
poppler-utils \
libpq-dev \
gcc \
python3-dev \
postgresql-client \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set up virtual environment
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install Python packages
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p static templates/admin logs
# Make startup script executable
RUN chmod +x start.sh
# Create entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Set environment variables
ENV PYTHONPATH=/app
ENV UVICORN_PORT=8000
ENV UVICORN_WORKERS=4
EXPOSE ${PORT_BACKEND}
# Expose port
EXPOSE 8000
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["python", "main.py"]
# Use the new startup script in production mode
CMD ["./start.sh", "prod"]
# Alternative: Run initialization first, then production server
# CMD ["sh", "-c", "./start.sh init && ./start.sh prod"]
# Alternative: Use Python directly
# CMD ["python3", "main.py", "--mode", "prod"]