46 lines
1.0 KiB
Docker
46 lines
1.0 KiB
Docker
# Use Python 3.9 as base image
|
|
FROM python:3.9-slim
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
POETRY_VERSION=1.7.1 \
|
|
POETRY_HOME="/opt/poetry" \
|
|
POETRY_VIRTUALENVS_CREATE=false \
|
|
PYTHONPATH=/app
|
|
|
|
# Add Poetry to PATH
|
|
ENV PATH="$POETRY_HOME/bin:$PATH"
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
curl \
|
|
build-essential \
|
|
libpq-dev \
|
|
postgresql-client \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Poetry
|
|
RUN curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy project files
|
|
COPY pyproject.toml poetry.lock* ./
|
|
|
|
# Install dependencies
|
|
RUN poetry install --no-root --no-interaction --no-ansi
|
|
|
|
# Copy required directories
|
|
COPY Ztest/ ./Ztest/
|
|
COPY Services/ ./Services/
|
|
COPY ApiLayers/ ./ApiLayers/
|
|
COPY Services/ ./Services/
|
|
|
|
# Set entrypoint for running tests
|
|
ENTRYPOINT ["poetry", "run", "pytest"]
|
|
CMD ["-v", "--cov=Services", "Ztest/"]
|