Install sudo to allow changing to the Mayan user. Install the database drivers in the final image instead of the base image. Use variable instead of the literal binaries.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -12,6 +12,7 @@ ENV DEBIAN_FRONTEND noninteractive
|
|||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
ENV LC_ALL C.UTF-8
|
ENV LC_ALL C.UTF-8
|
||||||
ENV PROJECT_INSTALL_DIR=/opt/mayan-edms
|
ENV PROJECT_INSTALL_DIR=/opt/mayan-edms
|
||||||
|
ENV PYTHON_PIP=${PROJECT_INSTALL_DIR}/bin/pip
|
||||||
|
|
||||||
ARG APT_PROXY
|
ARG APT_PROXY
|
||||||
# Package caching
|
# Package caching
|
||||||
@@ -42,6 +43,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
python-wheel \
|
python-wheel \
|
||||||
redis-server \
|
redis-server \
|
||||||
sane-utils \
|
sane-utils \
|
||||||
|
sudo \
|
||||||
supervisor \
|
supervisor \
|
||||||
tesseract-ocr \
|
tesseract-ocr \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
@@ -55,9 +57,6 @@ rm -f /var/cache/apt/archives/*.deb
|
|||||||
ADD https://raw.githubusercontent.com/guilhem/apt-get-install/master/apt-get-install /usr/bin/
|
ADD https://raw.githubusercontent.com/guilhem/apt-get-install/master/apt-get-install /usr/bin/
|
||||||
RUN chmod +x /usr/bin/apt-get-install
|
RUN chmod +x /usr/bin/apt-get-install
|
||||||
|
|
||||||
# Install Python clients for librabbitmq, MySQL, PostgreSQL, REDIS
|
|
||||||
RUN pip install librabbitmq==1.6.1 mysql-python==1.2.5 psycopg2==2.7.3.2 redis==2.10.6
|
|
||||||
|
|
||||||
RUN adduser mayan --disabled-password --disabled-login --no-create-home --gecos ""
|
RUN adduser mayan --disabled-password --disabled-login --no-create-home --gecos ""
|
||||||
|
|
||||||
# Pillow can't find zlib or libjpeg on aarch64 (ODROID C2)
|
# Pillow can't find zlib or libjpeg on aarch64 (ODROID C2)
|
||||||
@@ -110,9 +109,9 @@ FROM BASE_IMAGE
|
|||||||
|
|
||||||
RUN mkdir -p /opt
|
RUN mkdir -p /opt
|
||||||
|
|
||||||
RUN virtualenv $PROJECT_INSTALL_DIR
|
RUN python /usr/lib/python2.7/dist-packages/virtualenv.py $PROJECT_INSTALL_DIR
|
||||||
|
|
||||||
WORKDIR /opt/mayan-edms/
|
WORKDIR $PROJECT_INSTALL_DIR
|
||||||
|
|
||||||
COPY --from=BUILDER_IMAGE /code/dist/*.whl .
|
COPY --from=BUILDER_IMAGE /code/dist/*.whl .
|
||||||
|
|
||||||
@@ -126,15 +125,15 @@ COPY --from=BUILDER_IMAGE /code/docker/version .
|
|||||||
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR
|
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR
|
||||||
|
|
||||||
# Install build Mayan EDMS
|
# Install build Mayan EDMS
|
||||||
RUN pip -u mayan $PROJECT_INSTALL_DIR/bin/pip install --no-cache-dir *.whl && \
|
RUN sudo -u mayan $PYTHON_PIP install --no-cache-dir *.whl && \
|
||||||
rm *.whl
|
rm *.whl
|
||||||
|
|
||||||
|
# Install Python clients for librabbitmq, MySQL, PostgreSQL, REDIS
|
||||||
|
RUN sudo -u mayan $PYTHON_PIP install --no-cache-dir librabbitmq==1.6.1 mysql-python==1.2.5 psycopg2==2.7.3.2 redis==2.10.6
|
||||||
|
|
||||||
# Setup supervisor
|
# Setup supervisor
|
||||||
COPY docker/etc/supervisor/mayan.conf /etc/supervisor/conf.d
|
COPY docker/etc/supervisor/mayan.conf /etc/supervisor/conf.d
|
||||||
|
|
||||||
# Allow flanker to autogenerate its PLY files
|
|
||||||
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR/lib/python2.7/site-packages/flanker/
|
|
||||||
|
|
||||||
RUN mkdir /var/lib/mayan
|
RUN mkdir /var/lib/mayan
|
||||||
VOLUME ["/var/lib/mayan"]
|
VOLUME ["/var/lib/mayan"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user