Commit 65b6fc66 authored by Alexandru Dura's avatar Alexandru Dura
Browse files

Add a script to build the Docker image

We need the user in the container and the user on the host to share
the same user id, in order to allow sharing a directory without any
access permissions problems.

Adding a script to enable each user to built her/his own container
and another to run an image from that container.
parent db9e6606
FROM ubuntu:18.04
RUN useradd -m pintos && echo pintos:pintos | chpasswd && \
usermod -aG sudo pintos
RUN useradd -m edaf35 -u $HOST_USER_ID && echo edaf35:edaf35 | chpasswd && \
usermod -aG sudo edaf35
# General-purpose utilities
RUN apt-get update && apt-get -y install \
......@@ -17,12 +19,17 @@ RUN apt-get update && apt-get -y install \
# Switch user
USER pintos
WORKDIR /home/pintos
USER edaf35
WORKDIR /edaf35
COPY ./ /home/edaf35/
RUN /bin/bash -c 'echo ". /home/edaf35/" >> /home/edaf35/.bashrc'
# Clone pintos - needs adjustment to the right repo
RUN git clone pintos
# RUN git clone pintos
RUN /bin/bash -c 'echo "pushd /home/pintos/pintos > /dev/null ; source ; popd > /dev/null" >> /home/pintos/.bashrc'
# RUN /bin/bash -c 'echo "pushd /home/pintos/pintos > /dev/null ; source ; popd > /dev/null" >> /home/pintos/.bashrc'
CMD /bin/bash
# CMD /bin/bash
#! /bin/bash
docker build --build-arg HOST_USER_ID=`id -u` -t edaf35:2021 .
#! /bin/bash
EDAF35_USER_ID=`id -u`
if [ $HOST_USER_ID != $EDAF35_USER_ID ] ; then
echo "*********************************** WARNING ***********************************************"
echo "* WARNING! Your user ID ($HOST_USER_ID) differs from the edaf35 user ID ($EDAF35_USER_ID). "
echo "* The directory /edaf35 is probably read-only. "
echo "*******************************************************************************************"
export PINTOS_HOME=/edaf35/pintos
export PATH=$PATH:$PINTOS_HOME/src/utils
#! /bin/bash
THIS_SCRIPT=`realpath "$0"`
docker run --env HOST_USER_ID=`id -u` -it --mount type=bind,source="$EDAF35_DIR",target=/edaf35 edaf35:2021
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment