1- FROM python:3.10
1+ # Fmore information about the base image visit:
2+ # https://mcr.microsoft.com/en-us/artifact/mar/devcontainers/python/about
3+ FROM mcr.microsoft.com/devcontainers/python:3.10-bookworm
24
3- # avoid common warnings
5+ # disable common warning messages
46ENV DEBIAN_FRONTEND=noninteractive
57ENV PIP_ROOT_USER_ACTION=ignore
68ENV PIP_DISABLE_PIP_VERSION_CHECK=1
79
810# configure environment
911ARG ENVNAME="GraphRAG"
1012ARG USERNAME=vscode
11- ARG USER_UID=1001
12- ARG USER_GID=$USER_UID
1313ARG WORKDIR=/${ENVNAME}
1414
1515# install python, pip, git, and other required tools
@@ -53,13 +53,11 @@ RUN rm -rf /var/lib/apt/lists/* \
5353# set the location for the virtual environments to be outside the project directory
5454ENV POETRY_VIRTUALENVS_IN_PROJECT=true
5555
56- # set up non-root user
57- RUN useradd -ms /bin/bash -u ${USER_GID} ${USERNAME} \
58- && echo "${USERNAME}:${USERNAME}" | chpasswd \
59- # add user to sudo group and docker group
56+ # a non-root user (vscode) already exist in the base image. Add it to sudo group and docker group
57+ RUN echo "${USERNAME}:${USERNAME}" | chpasswd \
6058 && adduser ${USERNAME} sudo \
61- && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
62- && usermod -aG docker ${USERNAME}
59+ && adduser ${USERNAME} docker \
60+ && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
6361
6462# switch to non-root user
6563USER ${USERNAME}
@@ -73,13 +71,13 @@ ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
7371ENV PATH=/graphrag-accelerator/.venv/bin:$PATH
7472
7573# copy the project files into the container and set ownership
76- COPY --chown=${USERNAME}:${USER_GID } . ${WORKDIR}
74+ COPY --chown=${USERNAME}:${USERNAME } . ${WORKDIR}
7775
7876COPY entrypoint.sh /usr/local/bin/entrypoint.sh
7977
8078# Create directories for vscode server and extensions
81- RUN mkdir -p /home/$USERNAME /.vscode-server/extensions \
82- && chown -R $USER_UID:$USER_GID /home/$ USERNAME/.vscode-server
79+ RUN mkdir -p ~ /.vscode-server/extensions \
80+ && chown -R $USERNAME:$ USERNAME ~ /.vscode-server
8381
8482ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
8583CMD ["bash" ]
0 commit comments