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

51 lines
1.4 KiB

6 months ago
# Use an official Python runtime as a parent image
FROM python:3.11-slim-bullseye
6 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
6 months ago
3 weeks ago
# Set the working directory
6 months ago
WORKDIR /usr/src/app
3 weeks ago
# Copy the entire project into the container
6 months ago
COPY . .
3 weeks ago
# Install system dependencies and clean up
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*
6 months ago
3 weeks ago
# Install Poetry and pytest
RUN pip install --no-cache-dir poetry pytest
6 months ago
3 weeks ago
# Configure Poetry and install project dependencies
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi
6 months ago
3 weeks ago
# Create logs directory with proper permissions
RUN mkdir -p /usr/src/app/logs && chmod -R 777 /usr/src/app/logs
3 weeks ago
# Add pytest to PATH and verify installation
ENV PATH="/usr/local/bin:/root/.local/bin:$PATH"
# Verify pytest installation
RUN python -m pytest --version
# Create a shell script to run tests
COPY <<EOF /usr/local/bin/run-tests.sh
#!/bin/bash
python -m pytest "\$@"
EOF
3 weeks ago
RUN chmod +x /usr/local/bin/run-tests.sh
3 weeks ago
3 weeks ago
# Set the ENTRYPOINT to use the shell script
ENTRYPOINT ["/usr/local/bin/run-tests.sh"]
3 weeks ago
# Set default pytest arguments
CMD ["--continue-on-collection-errors", "--tb=short", "--disable-warnings"]