Update the Dockerfile.

Dockerfile has been modified to be compatible with the last
package versions of the Alpine distro
This commit is contained in:
Sylvain Tricot 2023-12-01 10:17:09 +01:00
parent 5f19198dec
commit de70cc04a1
1 changed files with 30 additions and 20 deletions

View File

@ -8,13 +8,15 @@ ARG folder=/opt/msspec user=msspec
# Install system dependencies # Install system dependencies
# tools # tools
RUN apk add bash git make gfortran python3 RUN apk add bash git make gfortran python3 py3-numpy-f2py
# headers # headers
RUN apk add python3-dev lapack-dev musl-dev RUN apk add python3-dev lapack-dev musl-dev hdf5-dev cairo-dev
# python packages # python packages
RUN apk add py3-virtualenv py3-pip py3-numpy-dev py3-h5py py3-lxml py3-matplotlib py3-numpy py3-pandas py3-cairo py3-scipy py3-setuptools_scm RUN apk add py3-virtualenv py3-pip py3-numpy-dev py3-h5py py3-lxml py3-matplotlib \
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing py3-wxpython py3-numpy py3-pandas py3-cairo py3-scipy py3-setuptools_scm \
RUN pip install ase pint terminaltables ipython py3-terminaltables ipython
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community py3-wxpython
#RUN pip install ase pint terminaltables ipython
# for GUI # for GUI
RUN apk add ttf-droid adwaita-icon-theme RUN apk add ttf-droid adwaita-icon-theme
RUN apk add build-base RUN apk add build-base
@ -24,19 +26,29 @@ RUN mkdir -p ${folder}/code
WORKDIR ${folder}/code WORKDIR ${folder}/code
RUN git clone --branch ${branch} https://${login}:${password}@git.ipr.univ-rennes1.fr/epsi/msspec_python3.git . RUN git clone --branch ${branch} https://${login}:${password}@git.ipr.univ-rennes1.fr/epsi/msspec_python3.git .
RUN virtualenv --system-site-packages ${folder}/.local/src/msspec_venv
RUN make pybinding PYTHON=python3 VENV_PATH=${folder}/.local/src/msspec_venv VERBOSE=1
RUN make -C src sdist PYTHON=python3 VENV_PATH=${folder}/.local/src/msspec_venv VERBOSE=1
RUN make -C src frontend PYTHON=python3 VENV_PATH=${folder}/.local/src/msspec_venv VERBOSE=1
RUN source ${folder}/.local/src/msspec_venv/bin/activate && pip install src/dist/msspec*tar.gz
# Build # Build
RUN make pybinding NO_VENV=1 PYTHON=python3 VERBOSE=1 #RUN make pybinding NO_VENV=1 PYTHON=python3 VERBOSE=1
RUN make -C src sdist PYTHON=python3 NO_VENV=1 VENV_PATH=${folder}/.local/src/msspec_venv && \ #RUN make -C src sdist PYTHON=python3 NO_VENV=1 VENV_PATH=${folder}/.local/src/msspec_venv
pip install src/dist/msspec*tar.gz #&& \
# pip install src/dist/msspec*tar.gz
# Add a non-privileged user # Add a non-privileged user
RUN adduser -D -s /bin/bash -h ${folder} ${user} #RUN adduser -D -s /bin/bash -h ${folder} ${user}
# Set the working directory in the container # Set the working directory in the container
USER ${user} #USER ${user}
RUN virtualenv --system-site-packages ${folder}/.local/src/msspec_venv #RUN virtualenv --system-site-packages ${folder}/.local/src/msspec_venv
RUN make -C src frontend PYTHON=python3 NO_VENV=1 VENV_PATH=${folder}/.local/src/msspec_venv #RUN source ${folder}/.local/src/msspec_venv/bin/activate && pip install src/dist/msspec*.tar.gz
#RUN make -C src frontend PYTHON=python3 NO_VENV=1 VENV_PATH=${folder}/.local/src/msspec_venv
@ -44,7 +56,7 @@ FROM alpine:edge
# Variables # Variables
ARG folder=/opt/msspec user=msspec ARG folder=/opt/msspec user=msspec
# Install system dependencies # Install system dependencies
RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community \
# hdf5-hl cairo openblas lapack libxml2 libxslt libzlf wxwidgets-gtk3 openjpeg libimagequant \ # hdf5-hl cairo openblas lapack libxml2 libxslt libzlf wxwidgets-gtk3 openjpeg libimagequant \
nano \ nano \
py3-virtualenv \ py3-virtualenv \
@ -72,12 +84,8 @@ RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
py3-scipy \ py3-scipy \
py3-setuptools_scm \ py3-setuptools_scm \
py3-wxpython \ py3-wxpython \
&& pip install \ py3-terminaltables \
ase \ py3-bayesian-optimization \
pint \
terminaltables \
ipython \
&& pip cache purge \
# Add a non-privileged user # Add a non-privileged user
&& adduser -D -s /bin/bash -h ${folder} ${user} && adduser -D -s /bin/bash -h ${folder} ${user}
@ -92,10 +100,12 @@ COPY --from=builder ${folder}/code/src/dist/msspec*tar.gz msspec.tar.gz
RUN virtualenv --system-site-packages .local/src/msspec_venv && \ RUN virtualenv --system-site-packages .local/src/msspec_venv && \
. .local/src/msspec_venv/bin/activate && \ . .local/src/msspec_venv/bin/activate && \
pip install msspec.tar.gz && \ pip install msspec.tar.gz && \
pip install ipython && \
pip cache purge && \
rm -f msspec.tar.gz && \ rm -f msspec.tar.gz && \
mkdir -p .local/bin mkdir -p .local/bin
COPY --from=builder ${folder}/.local/bin/msspec .local/bin/msspec COPY --from=builder /root/.local/bin/msspec .local/bin/msspec
ENV PATH=${folder}/.local/bin:$PATH ENV PATH=${folder}/.local/bin:$PATH
# Run the msspec frontend command on startup # Run the msspec frontend command on startup