potry updated

This commit is contained in:
berkay 2025-01-14 19:41:25 +03:00
parent 486fadbfb3
commit ad0b9aa218
4 changed files with 78 additions and 42 deletions

View File

@ -2,12 +2,23 @@ FROM python:3.9-slim
WORKDIR /app WORKDIR /app
# Install system dependencies # Install system dependencies and Poetry
RUN apt-get update && apt-get install -y \ RUN apt-get update \
gcc \ && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* gcc \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir poetry
# Copy all required directories # Copy Poetry configuration
COPY DockerApiServices/pyproject.toml ./pyproject.toml
# Configure Poetry and install dependencies with optimizations
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root --only main \
&& pip cache purge \
&& rm -rf ~/.cache/pypoetry
# Copy application code
COPY DockerApiServices/AllApiNeeds /app/ COPY DockerApiServices/AllApiNeeds /app/
COPY ApiLibrary /app/ApiLibrary COPY ApiLibrary /app/ApiLibrary
COPY ApiValidations /app/ApiValidations COPY ApiValidations /app/ApiValidations
@ -16,15 +27,10 @@ COPY ErrorHandlers /app/ErrorHandlers
COPY Schemas /app/Schemas COPY Schemas /app/Schemas
COPY Services /app/Services COPY Services /app/Services
# Install Python dependencies
COPY DockerApiServices/requirements.txt /app/
RUN pip install --upgrade pip && pip install --no-cache-dir -r /app/requirements.txt
# Copy application code
COPY . .
# Set Python path to include app directory # Set Python path to include app directory
ENV PYTHONPATH=/app ENV PYTHONPATH=/app \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Run the application using the configured uvicorn server # Run the application using the configured uvicorn server
CMD ["python", "app.py"] CMD ["poetry", "run", "python", "app.py"]

View File

@ -2,22 +2,35 @@ FROM python:3.9-slim
WORKDIR /app WORKDIR /app
# Install system dependencies # Install system dependencies and Poetry
RUN apt-get update && apt-get install -y \ RUN apt-get update \
gcc \ && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* gcc \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir poetry
# Install Python dependencies # Copy Poetry configuration
COPY pyproject.toml . COPY DockerApiServices/pyproject.toml ./pyproject.toml
RUN pip install poetry && \
poetry config virtualenvs.create false && \ # Configure Poetry and install dependencies with optimizations
poetry install --no-dev RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root --only main \
&& pip cache purge \
&& rm -rf ~/.cache/pypoetry
# Copy application code # Copy application code
COPY . . COPY DockerApiServices/AllApiNeeds /app/
COPY ApiLibrary /app/ApiLibrary
COPY ApiValidations /app/ApiValidations
COPY AllConfigs /app/AllConfigs
COPY ErrorHandlers /app/ErrorHandlers
COPY Schemas /app/Schemas
COPY Services /app/Services
# Expose port # Set Python path to include app directory
EXPOSE 8000 ENV PYTHONPATH=/app \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Run the application # Run the application using the configured uvicorn server
CMD ["uvicorn", "EventServiceApi.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["poetry", "run", "python", "app.py"]

View File

@ -2,22 +2,35 @@ FROM python:3.9-slim
WORKDIR /app WORKDIR /app
# Install system dependencies # Install system dependencies and Poetry
RUN apt-get update && apt-get install -y \ RUN apt-get update \
gcc \ && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* gcc \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir poetry
# Install Python dependencies # Copy Poetry configuration
COPY pyproject.toml . COPY DockerApiServices/pyproject.toml ./pyproject.toml
RUN pip install poetry && \
poetry config virtualenvs.create false && \ # Configure Poetry and install dependencies with optimizations
poetry install --no-dev RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root --only main \
&& pip cache purge \
&& rm -rf ~/.cache/pypoetry
# Copy application code # Copy application code
COPY . . COPY DockerApiServices/AllApiNeeds /app/
COPY ApiLibrary /app/ApiLibrary
COPY ApiValidations /app/ApiValidations
COPY AllConfigs /app/AllConfigs
COPY ErrorHandlers /app/ErrorHandlers
COPY Schemas /app/Schemas
COPY Services /app/Services
# Expose port # Set Python path to include app directory
EXPOSE 8000 ENV PYTHONPATH=/app \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Run the application # Run the application using the configured uvicorn server
CMD ["uvicorn", "ValidationServiceApi.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["poetry", "run", "python", "app.py"]

View File

@ -32,6 +32,10 @@ pytest = "^7.4.3"
pytest-asyncio = "^0.21.1" pytest-asyncio = "^0.21.1"
pytest-cov = "^4.1.0" pytest-cov = "^4.1.0"
# Monitoring
prometheus-client = "^0.19.0"
prometheus-fastapi-instrumentator = "^6.1.0"
# Utilities # Utilities
python-dateutil = "^2.8.2" python-dateutil = "^2.8.2"
typing-extensions = "^4.8.0" typing-extensions = "^4.8.0"