From 6a211e86557f7e30fb13cf636edb0ccc33f3988e Mon Sep 17 00:00:00 2001 From: Sam Toyer Date: Tue, 28 Mar 2023 13:17:16 -0700 Subject: [PATCH 1/2] Dockerfile from Felipe's students --- asnets/Dockerfile | 59 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/asnets/Dockerfile b/asnets/Dockerfile index b959423e..e5720aa4 100644 --- a/asnets/Dockerfile +++ b/asnets/Dockerfile @@ -1,14 +1,45 @@ -FROM ubuntu:19.10 -RUN apt-get update -y && apt-get install -y python3-numpy python3-dev \ - python3-pip python3-wheel python3-venv flex bison build-essential \ - autoconf libtool git cmake libboost-all-dev -RUN useradd -ms /bin/bash asnets -COPY . /home/asnets/asnets -RUN chown -R asnets:asnets /home/asnets/asnets -USER asnets -WORKDIR /home/asnets/asnets -RUN python3 -m venv ${HOME}/venv-asnets -RUN . ${HOME}/venv-asnets/bin/activate \ - && echo . ${HOME}/venv-asnets/bin/activate >> ${HOME}/.bashrc \ - && pip install --upgrade pip \ - && pip install -e ${HOME}/asnets/ +# Dockerfile for asnets +# +# To build: +# docker build -t asnets-bionic -f asnets-bionic.dockerfile . +# +# To run: +# docker run -i --rm --mount type=bind,source=,target=/home/asnets_user/shared -t asnets-bionic /bin/bash + +# Base container. +FROM ubuntu:bionic + +# Install packages. +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + python3-numpy python3-dev python3-pip python3-wheel python3-venv flex \ + bison build-essential autoconf libtool git libboost-all-dev cmake \ + libhdf5-dev g++ git make + +# Set up asnets user and group. +RUN groupadd -g 999 asnets_user \ + && useradd -r -u 999 -g asnets_user asnets_user \ + && mkdir /home/asnets_user \ + && chown -R asnets_user:asnets_user /home/asnets_user \ + && adduser asnets_user sudo \ + && echo "asnets ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +USER asnets_user + +# Make sure LD_LIBRARY_PATH is set correctly to include /usr/local/lib. +ENV LD_LIBRARY_PATH /usr/local/lib:/usr/local/lib/aarch64-linux-gnu:${LD_LIBRARY_PATH} + +WORKDIR /home/asnets_user + +# Install ASNets +RUN git clone https://github.com/qxcv/asnets.git + +RUN python3 -m venv venv-asnets && . venv-asnets/bin/activate \ + && pip3 install --upgrade pip \ + && pip3 install wheel cython numpy pkgconfig protobuf==3.19.6 werkzeug + +RUN . venv-asnets/bin/activate && pip3 install -e asnets/asnets + +RUN echo 'source ~/venv-asnets/bin/activate' >> ~/.bashrc + +RUN echo 'ulimit -S -v 64000000' >> ~/.bashrc From ca7d5443ec7a1db1679f50b00f39812f6403a3c1 Mon Sep 17 00:00:00 2001 From: Sam Toyer Date: Tue, 28 Mar 2023 20:18:52 +0000 Subject: [PATCH 2/2] Remove Singularity file --- asnets/singularity.def | 60 ------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 asnets/singularity.def diff --git a/asnets/singularity.def b/asnets/singularity.def deleted file mode 100644 index f47f1b7a..00000000 --- a/asnets/singularity.def +++ /dev/null @@ -1,60 +0,0 @@ -Bootstrap: library -From: ubuntu:18.04 -Stage: build - -%labels - Author sam@qxcv.net - Version v0.0.1 - -%help - A Singularity container for running various ASNets scripts. This may be - useful for users who want to set up an isolated environment for ASNets. - -%setup - set -e - old="$(pwd)" - cd ../ - git archive -o "${SINGULARITY_ROOTFS}/asnets-latest.tar" HEAD - cd "$old" - -%post - # getting to "usable Ubuntu" - # the LC_ALL thing is necessary to make pip etc. work properly - set -e - export LC_ALL=C.UTF-8 LANG=C.UTF-8 LC_LANG=C.UTF-8 - apt-get update -y - apt-get install -y software-properties-common - add-apt-repository universe - - # getting to "usable Python build system" - apt-get update -y - apt-get install -y python3-numpy python3-dev python3-pip python3-wheel \ - python3-venv flex bison build-essential autoconf libtool cmake git \ - mercurial libboost-dev - - # now drop privs - useradd -m -d /asnets asnets - chown asnets:asnets /asnets-latest.tar - # XXX I don't think this `su` is working; perhaps Singularity is running one - # command at a time, instead of piping this whole script to a shell? - su asnets - - # user-level stuff - cd /asnets - python3 -m venv asnet-env - . asnet-env/bin/activate - tar -xf /asnets-latest.tar - cd asnets - pip3 install -U setuptools pip wheel - pip3 install -r requirements.txt - pip install -e . - - # remove things that we don't need anymore - apt-get remove -y flex bison build-essential autoconf libtool \ - software-properties-common git mercurial cmake libboost-dev - apt-get autoremove -y - apt-get autoclean -y - -%runscript - . /asnets/asnet-env/bin/activate - python -m asnets.scripts.run_experiment $@