2023-04-24 21:27:53 +08:00
|
|
|
# 'dev' or 'release' container build
|
|
|
|
ARG BUILD_TYPE=dev
|
2023-04-14 10:36:47 +08:00
|
|
|
|
2023-04-25 01:03:21 +08:00
|
|
|
# Use an official Python base image from the Docker Hub
|
|
|
|
FROM python:3.10-slim AS autogpt-base
|
|
|
|
|
2023-04-24 21:27:53 +08:00
|
|
|
# Install browsers
|
|
|
|
RUN apt-get update && apt-get install -y \
|
2023-12-08 22:43:10 +08:00
|
|
|
chromium-driver ca-certificates gcc \
|
2023-06-07 09:14:47 +08:00
|
|
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
2023-04-16 05:37:50 +08:00
|
|
|
|
2023-04-24 21:27:53 +08:00
|
|
|
# Install utilities
|
2023-06-07 09:14:47 +08:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
curl jq wget git \
|
|
|
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
2023-04-16 05:37:50 +08:00
|
|
|
|
2023-04-14 10:47:28 +08:00
|
|
|
# Set environment variables
|
|
|
|
ENV PIP_NO_CACHE_DIR=yes \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
2023-09-15 11:18:44 +08:00
|
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
POETRY_HOME="/opt/poetry" \
|
2023-12-01 17:39:43 +08:00
|
|
|
POETRY_VIRTUALENVS_PATH="/venv" \
|
2023-09-15 11:18:44 +08:00
|
|
|
POETRY_VIRTUALENVS_IN_PROJECT=0 \
|
|
|
|
POETRY_NO_INTERACTION=1
|
2023-04-14 10:47:28 +08:00
|
|
|
|
2023-09-15 11:18:44 +08:00
|
|
|
# Install and configure Poetry
|
|
|
|
RUN curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
ENV PATH="$POETRY_HOME/bin:$PATH"
|
|
|
|
RUN poetry config installer.max-workers 10
|
|
|
|
|
2024-05-23 00:11:16 +08:00
|
|
|
WORKDIR /app/autogpt
|
2024-09-20 22:50:43 +08:00
|
|
|
COPY original_autogpt/pyproject.toml original_autogpt/poetry.lock ./
|
2024-05-23 00:11:16 +08:00
|
|
|
|
|
|
|
# Include forge so it can be used as a path dependency
|
|
|
|
COPY forge/ ../forge
|
|
|
|
|
|
|
|
# Include frontend
|
|
|
|
COPY frontend/ ../frontend
|
2023-04-14 10:47:28 +08:00
|
|
|
|
2023-04-25 01:03:21 +08:00
|
|
|
# Set the entrypoint
|
2023-11-25 01:50:33 +08:00
|
|
|
ENTRYPOINT ["poetry", "run", "autogpt"]
|
2023-09-17 22:47:57 +08:00
|
|
|
CMD []
|
2023-04-14 10:47:28 +08:00
|
|
|
|
2023-04-25 01:03:21 +08:00
|
|
|
# dev build -> include everything
|
2024-09-20 22:50:43 +08:00
|
|
|
FROM autogpt-base AS autogpt-dev
|
2023-12-08 22:43:10 +08:00
|
|
|
RUN poetry install --no-cache --no-root \
|
|
|
|
&& rm -rf $(poetry env info --path)/src
|
2024-09-20 22:50:43 +08:00
|
|
|
ONBUILD COPY original_autogpt/ ./
|
2024-11-15 15:48:00 +08:00
|
|
|
ONBUILD RUN mkdir -p ./data
|
2023-04-14 10:47:28 +08:00
|
|
|
|
2023-04-25 01:03:21 +08:00
|
|
|
# release build -> include bare minimum
|
2024-09-20 22:50:43 +08:00
|
|
|
FROM autogpt-base AS autogpt-release
|
2023-12-08 22:43:10 +08:00
|
|
|
RUN poetry install --no-cache --no-root --without dev \
|
|
|
|
&& rm -rf $(poetry env info --path)/src
|
2024-09-20 22:50:43 +08:00
|
|
|
ONBUILD COPY original_autogpt/ ./autogpt
|
|
|
|
ONBUILD COPY original_autogpt/README.md ./README.md
|
2024-11-15 15:48:00 +08:00
|
|
|
ONBUILD RUN mkdir -p ./data
|
2023-04-25 01:03:21 +08:00
|
|
|
|
2023-09-15 11:18:44 +08:00
|
|
|
FROM autogpt-${BUILD_TYPE} AS autogpt
|
|
|
|
RUN poetry install --only-root
|