prod-wag-backend-automate-s.../api_services/api_builds/initial_service/Dockerfile

27 lines
992 B
Docker

FROM python:3.12-slim
WORKDIR /
# Install system dependencies and Poetry
RUN apt-get update && apt-get install -y --no-install-recommends gcc && rm -rf /var/lib/apt/lists/* && pip install --no-cache-dir poetry
# Copy Poetry configuration
COPY /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 /api_services/api_controllers /api_controllers
COPY /api_services/schemas /schemas
COPY /api_services/api_modules /api_modules
COPY /api_services/api_builds/initial-service /initial-service
COPY /api_services/api_builds/initial-service /
# Set Python path to include app directory
ENV PYTHONPATH=/ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
# Run the application using the configured uvicorn server
CMD ["poetry", "run", "python", "initial-service/app.py"]