-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
21 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,42 @@ | ||
# 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 \ | ||
g++ \ | ||
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 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]>"] | ||
|
@@ -76,6 +76,8 @@ aiofiles = "*" | |
clusterops = "*" | ||
# chromadb = "*" | ||
rich = "*" | ||
numpy = "*" | ||
litellm = "*" | ||
# sentence-transformers = "*" | ||
|
||
|
||
|