grassloper/deploy/dockerapp/Dockerfile

55 lines
1.9 KiB
Docker

# Get the base Python image
FROM alpine:edge
LABEL maintainer="guillaume.raffy@univ-rennes.fr"
# Variables
ARG installdir=/opt/grassloper user=grassloper
# Install system dependencies
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 \
nano \
# hdf5-dev \
py3-virtualenv \
bash \
git \
python3 \
py3-pip \
py3-h5py \
py3-matplotlib \
py3-numpy \
py3-opencv \
py3-scipy
# py3-setuptools_scm \
# py3-terminaltables
# disabled install of py3-h5py /usr/lib/python3.11/site-packages/h5py/__init__.py:36: UserWarning: h5py is running against HDF5 1.14.3 when it was built against 1.14.2, this may cause problems
# _warn(("h5py is running against HDF5 {0} when it was built against {1}, "
# Add a non-privileged user
RUN adduser -D -s /bin/bash ${user}
# Set the working directory in the container
WORKDIR ${installdir}
# Install grassloper
RUN git clone https://git.ipr.univ-rennes.fr/graffy/grassloper ./grassloper.git
# remove opencv-python from grassloper's dependencies because it causes pip to unnecessarily attempt to install it (and it would fail because some building tools are missing) even if it's already installed on the system (god know why)
RUN sed -i "s/, 'opencv-python'//" ./grassloper.git/setup.py
# COPY . ./grassloper.git
RUN git clone https://github.com/g-raffy/improtools ./improtools.git
# COPY improtools.git ./improtools.git
RUN virtualenv --system-site-packages ${installdir}/grassloper.venv
RUN . ${installdir}/grassloper.venv/bin/activate && \
pip list && \
pip install ./improtools.git
RUN . ${installdir}/grassloper.venv/bin/activate && \
pip list && \
pip install ./grassloper.git
RUN . ${installdir}/grassloper.venv/bin/activate && \
pip cache purge
USER ${user}
ENV PATH=${installdir}/grassloper.venv/bin:$PATH
# Run the grassloper command on startup
ENTRYPOINT ["grassloper"]