commit 7aaa6f1ed9028658b96af3a7b9b708daaded6992 Author: Luca Rullo Date: Sat Mar 23 12:39:29 2024 +0100 Update: Docker Image Omeka S - Apache2 PHP8.1 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..840d90f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,169 @@ +FROM debian:stable-slim as builder + +ARG PHP_VERSION=8.1 +ARG NODE_VERSION=18 +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get update && apt-get install -y git curl ca-certificates + +WORKDIR omeka + +RUN git clone --depth 1 --recursive https://github.com/omeka/omeka-s.git +RUN chmod 775 omeka-s + +WORKDIR /omeka/omeka-s + +SHELL ["/bin/bash", "-c"] + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + +## Install Older version +RUN apt-get -y install lsb-release ca-certificates curl +RUN curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg +RUN sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' + +RUN apt-get update && \ + apt-get -qy install \ + php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php${PHP_VERSION}-xmlrpc php${PHP_VERSION}-soap php${PHP_VERSION}-intl php${PHP_VERSION}-zip php${PHP_VERSION}-imagick\ + ghostscript git wget sudo curl openssl imagemagick\ + poppler-utils && \ + apt-get clean + +RUN cp /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm + +RUN export NVM_DIR="$HOME/.nvm" \ + && \. "$NVM_DIR/nvm.sh" \ + && nvm install stable \ + && npm install \ + && npx gulp init + +# Composer PHP +RUN apt-get install -qy wget php${PHP_VERSION}-cli php${PHP_VERSION}-zip unzip && \ + wget -O /tmp/composer-setup.php https://getcomposer.org/installer && \ + php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer && \ + composer self-update + +# Install modules Nov 2020 + +RUN apt-get -qy install wget unzip + +# oai pmh module +RUN wget https://github.com/Daniel-KM/Omeka-S-module-OaiPmhRepository/releases/download/3.4.7/OaiPmhRepository-3.4.7.zip -O /tmp/oaipmh.zip +RUN unzip /tmp/oaipmh.zip -d modules/ + +# import from omeka 2 +RUN wget https://github.com/omeka-s-modules/Omeka2Importer/releases/download/v1.5.1/Omeka2Importer-1.5.1.zip -O /tmp/importer.zip +RUN unzip /tmp/importer.zip -d modules/ + +# bulk edition +RUN wget https://github.com/Daniel-KM/Omeka-S-module-BulkEdit/releases/download/3.4.26/BulkEdit-3.4.26.zip -O /tmp/bulkedit.zip +RUN unzip /tmp/bulkedit.zip -d modules/ + +# Easy Admin +RUN wget https://github.com/Daniel-KM/Omeka-S-module-EasyAdmin/releases/download/3.4.16/EasyAdmin-3.4.16.zip -O /tmp/EasyAdmin.zip +RUN unzip /tmp/EasyAdmin.zip -d modules/ + +# custom vocab +RUN wget https://github.com/omeka-s-modules/CustomVocab/releases/download/v2.0.2/CustomVocab-2.0.2.zip -O /tmp/customvocab.zip +RUN unzip /tmp/customvocab.zip -d modules/ + +# Advanced Search +RUN wget https://github.com/Daniel-KM/Omeka-S-module-AdvancedSearch/releases/download/3.4.6.20/AdvancedSearch-3.4.6.20.zip -O /tmp/AdvancedSearch.zip +RUN unzip /tmp/AdvancedSearch.zip -d modules/ + +RUN wget https://github.com/omeka-s-modules/MetadataBrowse/releases/download/v1.6.0/MetadataBrowse-1.6.0.zip -O /tmp/MetadataBrowse.zip +RUN unzip /tmp/MetadataBrowse.zip -d modules/ + +RUN wget https://github.com/omeka-s-modules/Mapping/releases/download/v1.10.0/Mapping-1.10.0.zip -O /tmp/Mapping.zip +RUN unzip /tmp/Mapping.zip -d modules/ + +# SiteSlug as Domain +RUN git clone https://github.com/kyfr59/omeka-s-module-SiteSlugAsSubdomain.git modules/SiteSlugAsSubdomain + +# ValueSuggest +RUN git clone https://github.com/omeka-s-modules/ValueSuggest.git modules/ValueSuggest + +# Rights Statements +RUN git clone https://github.com/zerocrates/RightsStatements.git modules/RightsStatements + +# Mapping +RUN git clone https://github.com/omeka-s-modules/Mapping.git modules/Mapping + +# CSS Editor +RUN git clone https://github.com/omeka-s-modules/CSSEditor.git modules/CSSEditor + +# extract pdf content to text field +RUN git clone https://github.com/omeka-s-modules/ExtractText.git modules/ExtractText + +# Comments +RUN git clone https://gitlab.com/Daniel-KM/Omeka-S-module-Comment.git modules/Comment + +# Blocks Disposition / Generic / Folksonomy +RUN git clone https://github.com/Daniel-KM/Omeka-S-module-BlocksDisposition.git modules/BlocksDisposition +RUN git clone https://gitlab.com/Daniel-KM/Omeka-S-module-Generic.git modules/Generic +RUN git clone https://github.com/Daniel-KM/Omeka-S-module-Folksonomy.git modules/Folksonomy + +RUN rm -rf /tmp/*.zip + +### < END BUILDER > ### + +FROM debian:stable-slim + +ARG PHP_VERSION=8.1 + +# Install dependencies +ENV DEBIAN_FRONTEND noninteractive + +## Install Older version +RUN apt-get update && \ + apt-get -y install lsb-release ca-certificates curl +RUN curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg +RUN sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' + +RUN apt-get update && \ + apt-get -qy install \ + php${PHP_VERSION}-fpm php${PHP_VERSION}-mysql php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-mbstring php${PHP_VERSION}-xml php${PHP_VERSION}-xmlrpc php${PHP_VERSION}-soap php${PHP_VERSION}-intl php${PHP_VERSION}-zip php${PHP_VERSION}-imagick\ + ghostscript git wget sudo curl openssl imagemagick\ + poppler-utils && \ + apt-get clean + +RUN update-alternatives --install /usr/bin/php php /usr/bin/php${PHP_VERSION} 99 --force +RUN update-alternatives --set php /usr/bin/php${PHP_VERSION} + +RUN cp /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm + +RUN apt install -y \ + apache2 apache2-utils libapache2-mod-php${PHP_VERSION} + +COPY ./envvars /etc/apache2/envvars +COPY ./omeka.apache2.conf /etc/apache2/sites-available/000-default.conf + +RUN a2enmod rewrite alias authz_user ssl headers + +RUN useradd omeka -d /var/www/html/ && \ + adduser omeka www-data && \ + adduser omeka users + +RUN chown -R omeka:users /var/log/apache2 +RUN chmod -R 777 /var/lib/php/sessions + +# Extract Text +RUN apt-get -qy install catdoc docx2txt lynx odt2txt poppler-utils + +# Install omeka +COPY --from=builder /omeka/omeka-s /var/www/html/omeka-s + +RUN chown -R omeka:omeka /var/www/html/omeka-s + +WORKDIR /var/www/html/omeka-s + +USER root + +COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh + +EXPOSE 80 +VOLUME /var/www/html/omeka-s/files + +ENTRYPOINT ["/bin/bash","/usr/local/bin/docker-entrypoint.sh"] + +CMD ["apachectl","-D","FOREGROUND"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..f2b66b4 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +# Omeka S - Apache2 PHP + +Docker image for _Omeka S_ using Apache2 + +Runing Apache2 with _omeka_ user + +https://omeka.org/s/ + +Preinstaller modules: + +- Omeka Importer +- PMH Repository +- Bulk Edit +- Easy Admin +- Custom Vocab +- Advanced Search +- Metadata Browse +- Mapping +- Site Slug as Subdomain +- Value Suggest +- Rights Statemets +- CSS Editor +- Extract Text +- Comment +- Blocks Disposition +- Generic +- Folksonomy + +## Configure + +Environment variables: + +* MYSQL_DATABASE omeka +* MYSQL_USER omeka +* MYSQL_PASSWORD omeka +* MYSQL_HOST db + +## Use + +``` +$ docker compose up -d +``` + +## Build + +``` +$ docker build . -t omeka-s:php-fpm8.1 --build-arg PHP_VERSION=8.1 --build-arg NODE_VERSION=20 +``` diff --git a/database.ini b/database.ini new file mode 100644 index 0000000..c803dff --- /dev/null +++ b/database.ini @@ -0,0 +1,7 @@ +user = "omeka" +password = "pass" +dbname = "omeka" +host = "db" +;port = +;unix_socket = +;log_path = diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..38de992 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' + +volumes: + db: + data: + +services: + db: + image: mysql:latest + container_name: db + volumes: + - db:/var/lib/mysql + environment: + MYSQL_DATABASE: omeka + MYSQL_USER: omeka + MYSQL_PASSWORD: omeka + MYSQL_RANDOM_ROOT_PASSWORD: true + + omeka-s: + image: registry.audio-lab.org/omeka-s:apache-php8.1 + build: + context: . + args: + PHP_VERSION: 8.1 + NODE_VERSION: 20 + container_name: omeka-s + links: + - db + volumes: + - data:/omeka + environment: + MYSQL_DATABASE: omeka + MYSQL_USER: omeka + MYSQL_PASSWORD: omeka + MYSQL_HOST: db diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..f066be7 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# CONFIGURE DATABASE +set -e; + +if [[ -z "$MYSQL_USER" ]]; then MYSQL_USER="omeka"; fi +if [[ -z "$MYSQL_PASSWORD" ]]; then MYSQL_PASSWORD="omeka"; fi +if [[ -z "$MYSQL_DATABASE" ]]; then MYSQL_DATABASE="omeka"; fi +if [[ -z "$MYSQL_HOST" ]]; then MYSQL_HOST="db"; fi + +printf 'user = "%s"\npassword = "%s"\ndbname = "%s"\nhost = "%s"\n' $MYSQL_USER $MYSQL_PASSWORD $MYSQL_DATABASE $MYSQL_HOST > /var/www/html/omeka-s/config/database.ini + +exec "$@" diff --git a/envvars b/envvars new file mode 100644 index 0000000..5a035b2 --- /dev/null +++ b/envvars @@ -0,0 +1,9 @@ +export APACHE_RUN_USER=omeka +export APACHE_RUN_GROUP=users +export APACHE_PID_FILE=/tmp/apache2.pid +export APACHE_RUN_DIR=/tmp/apache2 +export APACHE_LOCK_DIR=/tmp/apache2 +export APACHE_LOG_DIR=/tmp/apache2 + +export LANG=C +export LANG diff --git a/omeka.apache2.conf b/omeka.apache2.conf new file mode 100644 index 0000000..5dd51fd --- /dev/null +++ b/omeka.apache2.conf @@ -0,0 +1,14 @@ + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html/omeka-s/ + + + Options FollowSymlinks + AllowOverride All + Require all granted + + + ErrorLog /tmp/apache2.error.log + TransferLog /dev/stdout + +