Installation for S&D
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

132 lines
3.4 KiB

# From here we will move the composer binary
FROM composer:1.10 AS composer
# Download base image ubuntu 20.04
FROM ubuntu:20.04
# Changing sh shell to bash
SHELL ["/bin/bash", "-c", "-o", "pipefail"]
# Change working directory
WORKDIR /var/www/html
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
# Install Apache, PHP7.4-FPM, Supervisor
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
apache2 \
apache2-doc \
apache2-utils \
ca-certificates \
curl \
git \
libapache2-mod-fcgid \
php7.4 \
php7.4-common \
php7.4-fpm \
php7.4-mbstring \
php7.4-xml \
php7.4-zip \
software-properties-common \
supervisor
# Configure packages
RUN a2enmod rewrite actions fcgid alias proxy_fcgi setenvif remoteip && \
a2enconf php7.4-fpm && \
bash -c 'echo "RemoteIPHeader X-Forwarded-For" >> /etc/apache2/apache2.conf' && \
sed -i "s/LogFormat \"%v:%p %h/LogFormat \"%v:%p %a/g" /etc/apache2/apache2.conf && \
sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf && \
sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf && \
mkdir -p /run/php && \
mkdir -p /var/run/apache2 && \
mkdir -p /var/lock/apache2 && \
mkdir -p /var/log/supervisor && \
chown -R www-data:www-data /var/www/html && \
chown -R www-data:www-data /run/php && \
rm /var/www/html/index.html
# This is a laravel application, change DocRoot
RUN sed -i 's/\/var\/www\/html/&\/public/g' /etc/apache2/sites-available/000-default.conf
# Expose environment variables
RUN sed -i 's/;clear_env = .*/clear_env = no/g' /etc/php/*/fpm/pool.d/www.conf
# Install LibreOffice
RUN apt-get update -y && \
apt-add-repository -y ppa:libreoffice/ppa && \
apt-get update -y && \
apt-get install -y libreoffice
# Install Python3
RUN apt-get update -y && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get install -y \
build-essential \
libpoppler-cpp-dev \
pkg-config \
python3 \
python3-dev
# Install PDF Convertor
RUN apt-get update -y && \
apt-get install -y \
libpoppler-cpp-dev \
poppler-utils
# Install Tesseract OCR, Pandoc, DOCX to PDF Convertor, Unpaper
RUN apt-get update -y && \
add-apt-repository -y ppa:alex-p/tesseract-ocr-devel && \
apt-get update -y && \
apt-get install -y \
pandoc \
tesseract-ocr \
unoconv \
unpaper
# Install Pip
RUN apt-get update -y && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python3 get-pip.py && \
rm -rf get-pip.py && \
pip3 install --upgrade pip
# Cleanup apt cache
RUN rm -rf /var/lib/apt/lists/*
# Install PdfToText
RUN pip3 install pdftotext
# Prepare Supervisor
RUN mkdir /var/log/queue
## Install Dewarp
WORKDIR /var/www/html/resources/python/dewarp
RUN pip3 install opencv-python
WORKDIR /var/www/html
# Move configuraton files
COPY conf/supervisord_ingest.conf /etc/supervisor/conf.d/supervisord.conf
# Move repository
COPY --chown=www-data:www-data searchanddisplace-ingest/ .
# Here we do the magic!
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
# Install PHP Dependencies
RUN composer install
# Generate key
RUN php artisan key:generate
# Expose Port for the Application
EXPOSE 80 443
# Copy start.sh script and define default command for the container
CMD ["/usr/bin/supervisord"]