Spaces:
Runtime error
Runtime error
File size: 1,186 Bytes
ffcf62f f5762ed ffcf62f cc9a8ac e25db6f f5762ed e25db6f 6e945e4 ffcf62f cc9a8ac ffcf62f cc9a8ac f3b6736 3a0352b ffcf62f 3a0352b f3b6736 f5762ed f3b6736 3a0352b ffcf62f f3b6736 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Create a non-root user
RUN useradd --create-home --shell /bin/bash myuser
# Set the working directory in the container
WORKDIR /usr/src/swarms
# Change ownership of the workspace directory to the new user
RUN mkdir -p /usr/src/swarms/agent_workspace && \
chown -R myuser:myuser /usr/src/swarms/agent_workspace
# Switch to the non-root user
USER myuser
# Copy the requirements file and pyproject.toml to the container
COPY pyproject.toml requirements.txt ./
# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Install additional dependencies, including swarm-models
RUN pip install fastapi uvicorn pydantic loguru python-dotenv swarm-models
# Copy the rest of the application files from the root
COPY . .
# Verify installations
RUN python --version
RUN pip show fastapi uvicorn pydantic loguru python-dotenv swarm-models
# Expose port for FastAPI
EXPOSE 8000
# Command to run the FastAPI app using Uvicorn
CMD ["python", "-m", "uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|