You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/tests/Dockerfile

43 lines
1.4 KiB

5 months ago
# Use an official Python runtime as a parent image
FROM python:3.11-slim-bullseye
5 months ago
# Set environment variables for Python behavior
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100
5 months ago
7 days ago
# Set the working directory to the root of the project (relative to pyproject.toml)
5 months ago
WORKDIR /usr/src/app
7 days ago
# Copy the entire project into the container
5 months ago
COPY . .
7 days ago
# Install Poetry
5 months ago
RUN pip install poetry
# Configure Poetry to avoid virtual environments and install dependencies
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi
5 months ago
7 days ago
# Install pytest explicitly
7 days ago
RUN pip install pytest
5 months ago
7 days ago
# Check if pytest is installed successfully
7 days ago
RUN pytest --version || echo "pytest not found"
7 days ago
# Ensure the logs directory has correct permissions
RUN mkdir -p /usr/src/app/logs && chmod -R 777 /usr/src/app/logs
# Ensure that the PATH includes the directory where pytest is installed
ENV PATH="/usr/local/bin:$PATH"
7 days ago
# List files in /usr/src/app to check if pytest is installed correctly
7 days ago
RUN ls -l /usr/src/app
# Set the working directory to the tests directory inside the container
WORKDIR /usr/src/app/tests
# Default command to run tests located in the /tests directory
7 days ago
CMD pytest /usr/src/app/tests --continue-on-collection-errors --tb=short --disable-warnings | tee /usr/src/app/logs/test_logs.txt