From 230340b1fdefa6a377e96c124bd69ea054a79aeb Mon Sep 17 00:00:00 2001 From: sylvain tricot Date: Fri, 17 Sep 2021 11:55:23 +0200 Subject: [PATCH] Work on docker support. pip was not the default script in the virtualenv in the docker image (pip3 was). So we had to use "ensurepip" as recommended by the pip team. The Dockerfile was a bit simplified. --- Dockerfile | 32 +++++++++++++------------------- Makefile | 2 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index c040593..72f3376 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,24 @@ # Get the base Python image FROM python:latest +# Install system dependencies +RUN apt-get update && apt-get install -y virtualenv gfortran libgtk-3-dev nano + +# Add a non-privileged user +RUN useradd -ms /bin/bash -d /opt/msspec msspec + # Set the working directory in the container -WORKDIR /code +USER msspec +RUN mkdir -p /opt/msspec/code +WORKDIR /opt/msspec/code # Fetch the code RUN git clone --branch devel https://git.ipr.univ-rennes1.fr/epsi/msspec_python3.git . +#COPY --chown=msspec:msspec . . -# Install system dependencies -RUN apt-get update && apt-get install -y virtualenv gfortran libgtk-3-dev - # Install msspec -ENV PATH=/opt/bin:$PATH -RUN make install VERBOSE=1 INSTALL_PREFIX=/opt - -# Add a non-privileged user -RUN useradd -ms /bin/bash msspec -USER msspec -WORKDIR /home/msspec - -# Customize a bit the prompt and load the msspec virtualenv -RUN echo "alias idle=\"python -m idlelib.idle 2>/dev/null\"" >> .bashrc && \ - echo "export PS1=\"\w\$ \"" >> .bashrc && \ - echo "$(msspec -e)" >> .bashrc && \ - mkdir data && \ - cp /code/doc/source/tutorials/copper/Cu_simple.py data/example.py +ENV PATH=/opt/msspec/.local/bin:$PATH +RUN make install VERBOSE=1 # Run the msspec frontend command on startup -ENTRYPOINT ["/bin/bash"] +ENTRYPOINT ["msspec"] diff --git a/Makefile b/Makefile index 3943831..9e5e7e6 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ pybinding: venv: ifeq ($(NO_VENV),0) @virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) - @$(INSIDE_VENV) pip install --upgrade pip && pip install -r src/pip.freeze + @$(INSIDE_VENV) python -m ensurepip --upgrade --default-pip && pip install -r src/pip.freeze endif