mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
44 lines
1.5 KiB
Docker
44 lines
1.5 KiB
Docker
FROM ghcr.io/zama-ai/concretefhe-env
|
|
|
|
ENV SRC_DIR=/src
|
|
|
|
# Default to Ubuntu default uid for first user
|
|
ARG BUILD_GID=1000
|
|
ARG BUILD_UID=1000
|
|
|
|
# Get sudo for our future user
|
|
RUN apt-get update && \
|
|
apt-get install --no-install-recommends -y sudo && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# From https://dev.to/emmanuelnk/using-sudo-without-password-prompt-as-non-root-docker-user-52bg
|
|
# Create dev_user and add it to relevant groups
|
|
# Create /src and make the dev user own it
|
|
# Ensure sudo group users are not asked for a password when using
|
|
# sudo command by ammending sudoers file
|
|
RUN groupadd -g "${BUILD_GID}" dev_user && \
|
|
adduser --disabled-password \
|
|
--uid "${BUILD_UID}" --gid "${BUILD_GID}" --shell /bin/bash --gecos "" dev_user && \
|
|
usermod -aG sudo dev_user && \
|
|
mkdir -p "${SRC_DIR}" && \
|
|
chown dev_user "${SRC_DIR}" && \
|
|
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
|
|
# Now switch to the newly created user
|
|
USER dev_user
|
|
|
|
RUN echo "source ~/dev_venv/bin/activate" >> ~/.bashrc && \
|
|
echo "if [[ \"\$?\" != \"0\" ]]; then" >> ~/.bashrc && \
|
|
echo " python3 -m venv ~/dev_venv" >> ~/.bashrc && \
|
|
echo " source ~/dev_venv/bin/activate" >> ~/.bashrc && \
|
|
echo " cd ${SRC_DIR}/ && make setup_env" >> ~/.bashrc && \
|
|
echo "fi" >> ~/.bashrc && \
|
|
echo "export MPLBACKEND=TkAgg" >> ~/.bashrc && \
|
|
touch ~/.sudo_as_admin_successful && \
|
|
mkdir -p ~/dev_venv && \
|
|
mkdir -p ~/.cache
|
|
|
|
WORKDIR ${SRC_DIR}
|
|
|
|
CMD ["/bin/bash"]
|