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.

130 lines
3.4 KiB

  1. # From here we will move the composer binary
  2. FROM composer:1.10 AS composer
  3. # Download base image ubuntu 20.04
  4. FROM ubuntu:20.04
  5. # Changing sh shell to bash
  6. SHELL ["/bin/bash", "-c", "-o", "pipefail"]
  7. # Change working directory
  8. WORKDIR /var/www/html
  9. # Disable Prompt During Packages Installation
  10. ARG DEBIAN_FRONTEND=noninteractive
  11. # Install Apache, PHP7.4-FPM, Supervisor
  12. RUN apt-get update -y && \
  13. apt-get install -y --no-install-recommends \
  14. apache2 \
  15. apache2-doc \
  16. apache2-utils \
  17. ca-certificates \
  18. curl \
  19. git \
  20. libapache2-mod-fcgid \
  21. php7.4 \
  22. php7.4-common \
  23. php7.4-fpm \
  24. php7.4-mbstring \
  25. php7.4-xml \
  26. php7.4-zip \
  27. software-properties-common \
  28. supervisor && \
  29. rm -rf /var/lib/apt/lists/*
  30. # Configure packages
  31. RUN a2enmod rewrite actions fcgid alias proxy_fcgi setenvif remoteip && \
  32. a2enconf php7.4-fpm && \
  33. bash -c 'echo "RemoteIPHeader X-Forwarded-For" >> /etc/apache2/apache2.conf' && \
  34. sed -i "s/LogFormat \"%v:%p %h/LogFormat \"%v:%p %a/g" /etc/apache2/apache2.conf && \
  35. sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf && \
  36. sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf && \
  37. mkdir -p /run/php && \
  38. mkdir -p /var/run/apache2 && \
  39. mkdir -p /var/lock/apache2 && \
  40. mkdir -p /var/log/supervisor && \
  41. chown -R www-data:www-data /var/www/html && \
  42. chown -R www-data:www-data /run/php && \
  43. rm /var/www/html/index.html
  44. # This is a laravel application, change DocRoot
  45. RUN sed -i 's/\/var\/www\/html/&\/public/g' /etc/apache2/sites-available/000-default.conf
  46. # Expose environment variables
  47. RUN sed -i 's/;clear_env = .*/clear_env = no/g' /etc/php/*/fpm/pool.d/www.conf
  48. # Install LibreOffice
  49. RUN apt-get update -y && \
  50. apt-add-repository -y ppa:libreoffice/ppa && \
  51. apt-get update -y && \
  52. apt-get install -y libreoffice
  53. # Install Python3
  54. RUN apt-get update -y && \
  55. apt-get install -y software-properties-common && \
  56. add-apt-repository -y ppa:deadsnakes/ppa && \
  57. apt-get install -y \
  58. build-essential \
  59. libpoppler-cpp-dev \
  60. pkg-config \
  61. python3 \
  62. python3-dev
  63. # Install PDF Convertor
  64. RUN apt-get update -y && \
  65. apt-get install -y \
  66. libpoppler-cpp-dev \
  67. poppler-utils
  68. # Install Tesseract OCR, Pandoc, DOCX to PDF Convertor, Unpaper
  69. RUN apt-get update -y && \
  70. add-apt-repository -y ppa:alex-p/tesseract-ocr-devel && \
  71. apt-get update -y && \
  72. apt-get install -y \
  73. pandoc \
  74. tesseract-ocr \
  75. unoconv \
  76. unpaper
  77. # Install Pip
  78. RUN apt-get update -y && \
  79. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
  80. python3 get-pip.py && \
  81. rm -rf get-pip.py && \
  82. pip3 install --upgrade pip
  83. # Install PdfToText
  84. RUN pip3 install pdftotext
  85. # Prepare Supervisor
  86. RUN mkdir /var/log/queue
  87. ## Install Dewarp
  88. WORKDIR /var/www/html/resources/python/dewarp
  89. RUN pip3 install opencv-python
  90. WORKDIR /var/www/html
  91. # Move configuraton files
  92. COPY conf/supervisord_ingest.conf /etc/supervisor/conf.d/supervisord.conf
  93. # Move repository
  94. COPY --chown=www-data:www-data searchanddisplace-ingest/ .
  95. # Here we do the magic!
  96. COPY --from=composer /usr/bin/composer /usr/local/bin/composer
  97. # Install PHP Dependencies
  98. RUN composer install
  99. # Generate key
  100. RUN php artisan key:generate
  101. # Expose Port for the Application
  102. EXPOSE 80 443
  103. # Copy start.sh script and define default command for the container
  104. CMD ["/usr/bin/supervisord"]