mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
chore: Move to the mono repo layout
This commit is contained in:
53
frontends/concrete-python/docker/Dockerfile.dev
Normal file
53
frontends/concrete-python/docker/Dockerfile.dev
Normal file
@@ -0,0 +1,53 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
ENV TZ=Europe/Paris
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
# Replace default archive.ubuntu.com with fr mirror
|
||||
# original archive showed performance issues and is farther away
|
||||
RUN sed -i 's|^deb http://archive|deb http://fr.archive|g' /etc/apt/sources.list
|
||||
|
||||
COPY ./script/make_utils/setup_os_deps.sh ./setup_os_deps.sh
|
||||
RUN ./setup_os_deps.sh --linux-install-python && rm ./setup_os_deps.sh
|
||||
|
||||
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"]
|
||||
Reference in New Issue
Block a user