| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- ARG OPEN_DEVIN_BUILD_VERSION=dev
- FROM node:21.7.2-bookworm-slim AS frontend-builder
- WORKDIR /app
- COPY ./frontend/package.json frontend/package-lock.json ./
- RUN npm install -g npm@10.5.1
- RUN npm ci
- COPY ./frontend ./
- RUN npm run make-i18n && npm run build
- FROM python:3.12.3-slim AS backend-builder
- WORKDIR /app
- ENV PYTHONPATH='/app'
- ENV POETRY_NO_INTERACTION=1 \
- POETRY_VIRTUALENVS_IN_PROJECT=1 \
- POETRY_VIRTUALENVS_CREATE=1 \
- POETRY_CACHE_DIR=/tmp/poetry_cache
- RUN apt-get update -y \
- && apt-get install -y curl make git build-essential \
- && python3 -m pip install poetry==1.8.2 --break-system-packages
- COPY ./pyproject.toml ./poetry.lock ./
- RUN touch README.md
- RUN export POETRY_CACHE_DIR && poetry install --without evaluation,llama-index --no-root && rm -rf $POETRY_CACHE_DIR
- FROM python:3.12.3-slim AS runtime
- WORKDIR /app
- ARG OPEN_DEVIN_BUILD_VERSION #re-declare for this section
- ENV RUN_AS_DEVIN=true
- # A random number--we need this to be different from the user's UID on the host machine
- ENV OPENDEVIN_USER_ID=42420
- ENV SANDBOX_API_HOSTNAME=host.docker.internal
- ENV USE_HOST_NETWORK=false
- ENV WORKSPACE_BASE=/opt/workspace_base
- ENV OPEN_DEVIN_BUILD_VERSION=$OPEN_DEVIN_BUILD_VERSION
- RUN mkdir -p $WORKSPACE_BASE
- RUN apt-get update -y \
- && apt-get install -y curl ssh sudo
- # Default is 1000, but OSX is often 501
- RUN sed -i 's/^UID_MIN.*/UID_MIN 499/' /etc/login.defs
- # Default is 60000, but we've seen up to 200000
- RUN sed -i 's/^UID_MAX.*/UID_MAX 1000000/' /etc/login.defs
- RUN groupadd app
- RUN useradd -l -m -u $OPENDEVIN_USER_ID -s /bin/bash opendevin && \
- usermod -aG app opendevin && \
- usermod -aG sudo opendevin && \
- echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
- RUN chown -R opendevin:app /app && chmod -R 770 /app
- RUN sudo chown -R opendevin:app $WORKSPACE_BASE && sudo chmod -R 770 $WORKSPACE_BASE
- USER opendevin
- ENV VIRTUAL_ENV=/app/.venv \
- PATH="/app/.venv/bin:$PATH" \
- PYTHONPATH='/app'
- COPY --chown=opendevin:app --chmod=770 --from=backend-builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
- RUN playwright install --with-deps chromium
- COPY --chown=opendevin:app --chmod=770 ./opendevin ./opendevin
- COPY --chown=opendevin:app --chmod=777 ./opendevin/runtime/plugins ./opendevin/runtime/plugins
- COPY --chown=opendevin:app --chmod=770 ./agenthub ./agenthub
- COPY --chown=opendevin:app --chmod=770 ./pyproject.toml ./pyproject.toml
- COPY --chown=opendevin:app --chmod=770 ./poetry.lock ./poetry.lock
- COPY --chown=opendevin:app --chmod=770 ./README.md ./README.md
- COPY --chown=opendevin:app --chmod=770 ./MANIFEST.in ./MANIFEST.in
- # This is run as "opendevin" user, and will create __pycache__ with opendevin:opendevin ownership
- RUN python opendevin/core/download.py # No-op to download assets
- # Add this line to set group ownership of all files/directories not already in "app" group
- # opendevin:opendevin -> opendevin:app
- RUN find /app \! -group app -exec chgrp app {} +
- RUN chown -R opendevin:app /app/logs && chmod -R 770 /app/logs # This gets created by the download.py script
- COPY --chown=opendevin:app --chmod=770 --from=frontend-builder /app/dist ./frontend/dist
- COPY --chown=opendevin:app --chmod=770 ./containers/app/entrypoint.sh /app/entrypoint.sh
- USER root
- WORKDIR /app
- ENTRYPOINT ["/app/entrypoint.sh"]
- CMD ["uvicorn", "opendevin.server.listen:app", "--host", "0.0.0.0", "--port", "3000"]
|