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

  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. # Configure packages
  30. RUN a2enmod rewrite actions fcgid alias proxy_fcgi setenvif remoteip && \
  31. a2enconf php7.4-fpm && \
  32. bash -c 'echo "RemoteIPHeader X-Forwarded-For" >> /etc/apache2/apache2.conf' && \
  33. sed -i "s/LogFormat \"%v:%p %h/LogFormat \"%v:%p %a/g" /etc/apache2/apache2.conf && \
  34. sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf && \
  35. sed -i "s/AllowOverride None/AllowOverride All/g" /etc/apache2/apache2.conf && \
  36. mkdir -p /run/php && \
  37. mkdir -p /var/run/apache2 && \
  38. mkdir -p /var/lock/apache2 && \
  39. mkdir -p /var/log/supervisor && \
  40. chown -R www-data:www-data /var/www/html && \
  41. chown -R www-data:www-data /run/php && \
  42. rm /var/www/html/index.html
  43. # This is a laravel application, change DocRoot
  44. RUN sed -i 's/\/var\/www\/html/&\/public/g' /etc/apache2/sites-available/000-default.conf
  45. # Expose environment variables
  46. RUN sed -i 's/;clear_env = .*/clear_env = no/g' /etc/php/*/fpm/pool.d/www.conf
  47. # Install LibreOffice
  48. RUN apt-get update -y && \
  49. apt-add-repository -y ppa:libreoffice/ppa && \
  50. apt-get update -y && \
  51. apt-get install -y libreoffice
  52. # Install Python3
  53. RUN apt-get update -y && \
  54. apt-get install -y software-properties-common && \
  55. add-apt-repository -y ppa:deadsnakes/ppa && \
  56. apt-get install -y \
  57. build-essential \
  58. libpoppler-cpp-dev \
  59. pkg-config \
  60. python3 \
  61. python3-dev
  62. # Install PDF Convertor
  63. RUN apt-get update -y && \
  64. apt-get install -y \
  65. libpoppler-cpp-dev \
  66. poppler-utils
  67. # Install Tesseract OCR, Pandoc, DOCX to PDF Convertor, Unpaper
  68. RUN apt-get update -y && \
  69. add-apt-repository -y ppa:alex-p/tesseract-ocr-devel && \
  70. apt-get update -y && \
  71. apt-get install -y \
  72. pandoc \
  73. tesseract-ocr \
  74. unoconv \
  75. unpaper
  76. # Install Pip
  77. RUN apt-get update -y && \
  78. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
  79. python3 get-pip.py && \
  80. rm -rf get-pip.py && \
  81. pip3 install --upgrade pip
  82. # Cleanup apt cache
  83. RUN rm -rf /var/lib/apt/lists/*
  84. # Install PdfToText
  85. RUN pip3 install pdftotext
  86. # Prepare Supervisor
  87. RUN mkdir /var/log/queue
  88. ## Install Dewarp
  89. WORKDIR /var/www/html/resources/python/dewarp
  90. RUN pip3 install opencv-python
  91. WORKDIR /var/www/html
  92. # Move configuraton files
  93. COPY conf/supervisord_ingest.conf /etc/supervisor/conf.d/supervisord.conf
  94. # Move repository
  95. COPY --chown=www-data:www-data searchanddisplace-ingest/ .
  96. # Here we do the magic!
  97. COPY --from=composer /usr/bin/composer /usr/local/bin/composer
  98. # Install PHP Dependencies
  99. RUN composer install
  100. # Generate key
  101. RUN php artisan key:generate
  102. # Expose Port for the Application
  103. EXPOSE 80 443
  104. # Copy start.sh script and define default command for the container
  105. CMD ["/usr/bin/supervisord"]