pull/762/head
Kye Gomez 2 months ago
parent ceffa6f66b
commit 2e6b2df013

@ -1,16 +1,20 @@
# Use Python 3.11 slim-bullseye for smaller base image
FROM python:3.11-slim-bullseye AS builder
# Use Python 3.11 slim-bullseye for a smaller base image
FROM python:3.11-slim-bullseye
# Set environment variables
# Set environment variables for Python and pip
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1
PIP_DISABLE_PIP_VERSION_CHECK=1 \
WORKSPACE_DIR="agent_workspace" \
PATH="/app:${PATH}" \
PYTHONPATH="/app:${PYTHONPATH}" \
USER=swarms
# Set the working directory
WORKDIR /build
WORKDIR /app
# Install only essential build dependencies
# Install essential build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
@ -18,40 +22,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gfortran \
&& rm -rf /var/lib/apt/lists/*
# Install swarms packages
RUN pip install --no-cache-dir swarm-models swarms
RUN pip install transformers torch litellm tiktoken openai pandas numpy pypdf
# Install required Python packages
RUN pip install --no-cache-dir swarm-models swarms && \
pip install --no-cache-dir transformers torch litellm tiktoken openai pandas numpy pypdf
# Production stage
FROM python:3.11-slim-bullseye
# Set secure environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
WORKSPACE_DIR="agent_workspace" \
PATH="/app:${PATH}" \
PYTHONPATH="/app:${PYTHONPATH}" \
USER=swarms
# Create non-root user
# Create a non-root user and set correct permissions for the application directory
RUN useradd -m -s /bin/bash -U $USER && \
mkdir -p /app && \
chown -R $USER:$USER /app
# Set working directory
WORKDIR /app
# Copy only necessary files from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application with correct permissions
# Copy application files into the image with proper ownership
COPY --chown=$USER:$USER . .
# Switch to non-root user
# Switch to the non-root user
USER $USER
# Health check
# Health check to ensure the container is running properly
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD python -c "import swarms; print('Health check passed')" || exit 1
CMD python -c "import swarms; print('Health check passed')" || exit 1

@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "swarms"
version = "7.0.9"
version = "7.1.1"
description = "Swarms - TGSC"
license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"]
@ -76,6 +76,8 @@ aiofiles = "*"
clusterops = "*"
# chromadb = "*"
rich = "*"
numpy = "*"
litellm = "*"
# sentence-transformers = "*"

Loading…
Cancel
Save