From 6a211e86557f7e30fb13cf636edb0ccc33f3988e Mon Sep 17 00:00:00 2001 From: Sam Toyer Date: Tue, 28 Mar 2023 13:17:16 -0700 Subject: [PATCH] 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