Files
DB-GPT/.devcontainer/Dockerfile.dev
geebytes 69b71a8cac feat:get user info by get_env.sh
chore(build):Optimize the zsh setup

fix(dev):Load .env on demand

fix(dev):install oh-my-zsh from mirror
2025-03-17 12:51:20 +00:00

40 lines
1.7 KiB
Docker

FROM eosphorosai/dbgpt:latest
ARG PYTHON_VERSION=3.11
ARG PIP_INDEX_URL="https://mirrors.aliyun.com/pypi/simple"
ARG USERNAME
ARG DEFAULT_VEN=/opt/.uv.venv
WORKDIR /app
COPY . .
USER root
# Set the GID and UID of the container and
# add a user to prevent permission mismatches
# between the container user (root) and the host user,
# and to resolve the issue of the host user lacking write permissions.
RUN . .devcontainer/.env && \
groupadd -g $USER_GID $USERNAME && \
useradd -u $USER_UID -g $USER_GID -m $USERNAME && \
chown -R $USER_UID:$USER_GID /app
RUN apt-get update && apt-get install -y \
git \
curl \
wget \
ssh zsh autojump curl git-flow vim sudo \
&& python${PYTHON_VERSION} -m pip install --upgrade pip \
&& python${PYTHON_VERSION} -m pip install --upgrade pipx \
&& pipx install -i $PIP_INDEX_URL uv --global \
&& chown -R $USERNAME:$USERNAME $DEFAULT_VEN \
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER $USERNAME
ENV UV_LINK_MODE=copy \
PIP_INDEX_URL=$PIP_INDEX_URL \
VIRTUAL_ENV=$DEFAULT_VEN \
UV_PROJECT_ENVIRONMENT=$DEFAULT_VEN \
UV_PYTHON=$DEFAULT_VEN/bin/python3
RUN . $DEFAULT_VEN/bin/activate && \
uv pip install --prefix $VIRTUAL_ENV -r pyproject.toml --all-extras --index-url=$PIP_INDEX_URL && \
uv pip install --prefix $VIRTUAL_ENV -r requirements/dev-requirements.txt --index-url=$PIP_INDEX_URL && \
uv pip install --prefix $VIRTUAL_ENV -r requirements/lint-requirements.txt --index-url=$PIP_INDEX_URL && \
cp .devcontainer/dbgpt.pth /opt/.uv.venv/lib/python${PYTHON_VERSION}/site-packages/dbgpt.pth && \
python -c "import dbgpt; print(dbgpt.__version__)"