Update Docker image

- Remove Redis from the Docker image.
- Add Celery flower.
- Add Python 3 packages needed for in-container pip installs.
- Fix typos.
- Allow PIP proxying.

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-07-23 21:12:11 -04:00
parent cb7d5bf82a
commit 5352c6ac6f
3 changed files with 13 additions and 85 deletions

View File

@@ -22,6 +22,7 @@ RUN set -x \
&& DEBIAN_FRONTEND=noninteractive \ && DEBIAN_FRONTEND=noninteractive \
apt-get update \ apt-get update \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
ca-certificates \
exiftool \ exiftool \
ghostscript \ ghostscript \
gpgv \ gpgv \
@@ -29,11 +30,11 @@ apt-get update \
graphviz \ graphviz \
libfuse2 \ libfuse2 \
libmagic1 \ libmagic1 \
libmmariadb3 \ libmariadb3 \
libreoffice \ libreoffice \
libpq5 \ libpq5 \
poppler-utils \ poppler-utils \
redis-server \ python3-distutils \
sane-utils \ sane-utils \
sudo \ sudo \
supervisor \ supervisor \
@@ -52,22 +53,20 @@ apt-get update \
&& if [ "$(uname -m)" = "armv7l" ]; then \ && if [ "$(uname -m)" = "armv7l" ]; then \
ln -s /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/ \ ln -s /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/ \
&& ln -s /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/ \ && ln -s /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/ \
; fi \ ; fi
# Discard data when Redis runs out of memory
&& echo "maxmemory-policy allkeys-lru" >> /etc/redis/redis.conf \
# Disable saving the Redis database
echo "save \"\"" >> /etc/redis/redis.conf \
# Only provision 1 database
&& echo "databases 1" >> /etc/redis/redis.conf
#### ####
# BUILDER_IMAGE - This image buildS the Python package and is discarded afterwards # BUILDER_IMAGE - This image builds the Python package and is discarded afterwards
# only the build artifact is carried over to the next image.
#### ####
# Reuse image # Reuse image
FROM BASE_IMAGE as BUILDER_IMAGE FROM BASE_IMAGE as BUILDER_IMAGE
# Python libraries caching
ARG PIP_INDEX_URL
ARG PIP_TRUSTED_HOST
WORKDIR /src WORKDIR /src
# Copy the source files needed to build the Python package # Copy the source files needed to build the Python package
@@ -110,6 +109,7 @@ RUN python3 -m venv "${PROJECT_INSTALL_DIR}" \
mysqlclient==1.4.2.post1 \ mysqlclient==1.4.2.post1 \
psycopg2==2.8.3 \ psycopg2==2.8.3 \
redis==3.2.1 \ redis==3.2.1 \
flower==0.9.3 \
# psutil is needed by ARM builds otherwise gevent and gunicorn fail to start # psutil is needed by ARM builds otherwise gevent and gunicorn fail to start
&& UNAME=`uname -m` && if [ "${UNAME#*arm}" != $UNAME ]; then \ && UNAME=`uname -m` && if [ "${UNAME#*arm}" != $UNAME ]; then \
pip install --no-cache-dir \ pip install --no-cache-dir \
@@ -118,7 +118,7 @@ RUN python3 -m venv "${PROJECT_INSTALL_DIR}" \
# Install the Python packages needed to build Mayan EDMS # Install the Python packages needed to build Mayan EDMS
&& pip install --no-cache-dir -r /src/requirements/build.txt \ && pip install --no-cache-dir -r /src/requirements/build.txt \
# Build Mayan EDMS # Build Mayan EDMS
&& python setup.py sdist \ && python3 setup.py sdist \
# Install the built Mayan EDMS package # Install the built Mayan EDMS package
&& pip install --no-cache-dir dist/mayan* \ && pip install --no-cache-dir dist/mayan* \
# Install the static content # Install the static content
@@ -128,7 +128,7 @@ RUN python3 -m venv "${PROJECT_INSTALL_DIR}" \
COPY --chown=mayan:mayan requirements/testing-base.txt "${PROJECT_INSTALL_DIR}" COPY --chown=mayan:mayan requirements/testing-base.txt "${PROJECT_INSTALL_DIR}"
#### ####
# Final image - BASE_IMAGE + Mayan install directory from the builder image # Final image - BASE_IMAGE + BUILDER_IMAGE artifact (Mayan install directory)
#### ####
FROM BASE_IMAGE FROM BASE_IMAGE

View File

@@ -1,72 +0,0 @@
version: '2.1'
volumes:
broker:
driver: local
app:
driver: local
db:
driver: local
results:
driver: local
services:
broker:
container_name: mayan-edms-broker
image: healthcheck/rabbitmq
environment:
RABBITMQ_DEFAULT_USER: mayan
RABBITMQ_DEFAULT_PASS: mayan
RABBITMQ_DEFAULT_VHOST: mayan
volumes:
- broker:/var/lib/rabbitmq
results:
container_name: mayan-edms-results
image: healthcheck/redis
volumes:
- results:/data
#db:
# container_name: mayan-edms-db
# image: healthcheck/mysql
# environment:
# MYSQL_DATABASE: mayan
# MYSQL_PASSWORD: mayan-password
# MYSQL_ROOT_PASSWORD: root-password
# MYSQL_USER: mayan
# volumes:
# - db:/var/lib/mysql
db:
container_name: mayan-edms-db
image: healthcheck/postgres
environment:
POSTGRES_DB: mayan
POSTGRES_PASSWORD: mayan-password
POSTGRES_USER: mayan
volumes:
- db:/var/lib/postgresql/data
mayan-edms:
container_name: mayan-edms-app
image: mayan-edms/next
build:
context: ./
args:
- APT_PROXY=172.18.0.1:3142
depends_on:
broker:
condition: service_healthy
db:
condition: service_healthy
results:
condition: service_healthy
environment:
MAYAN_BROKER_URL: amqp://mayan:mayan@broker:5672/mayan
MAYAN_CELERY_RESULT_BACKEND: redis://results:6379/0
MAYAN_DATABASE_ENGINE: django.db.backends.postgresql
MAYAN_DATABASE_HOST: db
MAYAN_DATABASE_NAME: mayan
MAYAN_DATABASE_PASSWORD: mayan-password
MAYAN_DATABASE_USER: mayan
ports:
- "80:80"
volumes:
- app:/var/lib/mayan