Docker image for Omeka Audiolab version

This commit is contained in:
Luca Rullo 2024-08-30 13:54:49 +02:00
commit bca97e34aa
No known key found for this signature in database
GPG Key ID: B4F223E232E0C82A
10 changed files with 529 additions and 0 deletions

245
Dockerfile Normal file
View File

@ -0,0 +1,245 @@
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.27/BulkEdit-3.4.27.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.18/EasyAdmin-3.4.18.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
## Require php 8..
## RUN git clone https://github.com/Daniel-KM/Omeka-S-module-AdvancedSearch.git modules/AdvancedSearch
## RUN cd modules/AdvancedSearch && composer update && composer install --no-dev && cd -
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
# metadata links
#RUN git clone https://gitlab.com/Daniel-KM/Omeka-S-module-MetadataBrowse.git modules/MetadataBrowse
# 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 git clone https://github.com/omeka-s-modules/FileSideload.git modules/FileSideload
#RUN git clone https://github.com/Daniel-KM/Omeka-S-module-DataTypeRdf.git modules/DataTypeRdf
RUN wget https://github.com/Daniel-KM/Omeka-s-module-DataTypeRdf/releases/download/3.4.9/DataTypeRdf-3.4.9.zip -O /tmp/DataTypeRdf.zip
RUN unzip /tmp/DataTypeRdf.zip -d modules/
#RUN git clone https://github.com/omeka-s-modules/CSVImport.git modules/CSVImport
RUN git clone https://github.com/Daniel-KM/Omeka-S-module-Common.git modules/Common
RUN wget https://github.com/omeka-s-modules/CSVImport/releases/download/v2.6.1/CSVImport-2.6.1.zip -O /tmp/CSVImport.zip
RUN unzip /tmp/CSVImport.zip -d modules/
RUN git clone https://gitlab.com/Daniel-KM/Omeka-S-module-DerivativeMedia.git modules/DerivativeMedia
RUN wget https://github.com/Daniel-KM/Omeka-s-module-AdvancedResourceTemplate/releases/download/3.4.31/AdvancedResourceTemplate-3.4.31.zip -O /tmp/AdvancedResourceTemplate.zip
RUN unzip /tmp/AdvancedResourceTemplate.zip -d modules/
RUN wget https://github.com/Daniel-KM/Omeka-s-module-BlockPlus/releases/download/3.4.22-alpha/BlockPlus-3.4.22-alpha.zip -O /tmp/BlockPlus.zip
RUN unzip /tmp/BlockPlus.zip -d modules/
RUN wget https://github.com/omeka-s-modules/NumericDataTypes/releases/download/v1.11.3/NumericDataTypes-1.11.3.zip -O /tmp/NumericDataTypes.zip
RUN unzip /tmp/NumericDataTypes.zip -d modules/
# TODO: bulk check - https://gitlab.com/Daniel-KM/Omeka-S-module-BulkCheck - depend Logs & Generic
#RUN git clone https://gitlab.com/Daniel-KM/Omeka-S-module-BulkCheck.git modules/BulkCheck
#RUN git clone https://gitlab.com/Daniel-KM/Omeka-S-module-Log.git modules/Log
# REPLACED by Easy Admin
#RUN git clone https://github.com/Daniel-KM/Omeka-S-module-EasyAdmin/releases/download/3.4.16/EasyAdmin-3.4.16.zip modules/EasyAdmin
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
#COPY omeka.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
#
#RUN mkdir -p /run/php/
#RUN mkdir -p logs
# Extract Text
RUN apt-get -qy install catdoc docx2txt lynx odt2txt poppler-utils
# Install for derivatives
RUN apt-get -qy install ffmpeg ghostscript
# 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
# Install NGINX
#RUN apt-get update && \
# apt-get -qy install nginx-full ssl-cert && \
# apt-get clean
#
#COPY nginx.conf /etc/nginx/nginx.conf
#
## Basic nginx directories
#RUN mkdir -p /var/lib/nginx/body && \
# mkdir -p /var/lib/nginx/proxy && \
# mkdir -p /var/lib/nginx/fastcgi && \
# mkdir -p /var/lib/nginx/scgi && \
# mkdir -p /var/lib/nginx/uwsgi
#
## Logging to stdout
#RUN ln -sf /proc/self/fd /dev/
#RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
#
## PID nginx for non-root users
#RUN mkdir -p /run/nginx && \
# chmod 777 /run/nginx && \
# chmod -R 777 /var/lib/nginx
#
## Use port 8080
#RUN sed -i 's/80/8080/g' /etc/nginx/sites-enabled/default
#RUN apt-get purge -qy nodejs git curl wget openssl
#RUN apt-get -qy clean
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 ["/usr/sbin/php-fpm","--nodaemonize"]]
CMD ["apachectl","-D","FOREGROUND"]

82
README.dockercompose.md Normal file
View File

@ -0,0 +1,82 @@
# Omeka S - Sindominio.net
Versión adaptada para la integración de __Omeka S__ en la infraestructura de _Sindominio_
Desarrollada para su uso en el repositorio _Hacer Laboratorio_ disponible en https://hacerlaboratorio.sindominio.net
Basada en tres imagenes Docker publicadas en el registry de Sindominio
* MariaDB: Base de datos
* PHPFPM: Código de Omeka S ejecutable a través de PHP FPM 7
* NGINX: Servidor web para acceder como proxy a PHPFPM y a los archivos no PHP de la aplicación de _Omeka S_
# Configuración
Configurar correctamente las variables de la base de datos _MYSQL_ y los volumenes.
Por defecto, los volúmenes se cargan en el espacio por defecto de Docker.
# Ejemplo Docker Compose
```
version: '3'
networks:
omekan:
external: false
volumes:
db:
data:
services:
db:
image: registry.sindominio.net/mariadb
#build: ./mariadb
container_name: db
networks:
- omekan
volumes:
- db:/var/lib/mysql
environment:
MYSQL_DATABASE: omeka_sd
MYSQL_USER: omeka_sd
MYSQL_PASSWORD: omeka_sd
phpfpm:
image: registry.sindominio.net/php-omeka-s
#build: ./php-omeka-s
container_name: phpfpm
networks:
- omekan
links:
- db
volumes:
- data:/sindominio
environment:
MYSQL_DATABASE: omeka_sd
MYSQL_USER: omeka_sd
MYSQL_PASSWORD: omeka_sd
MYSQL_HOST: db
nginx:
image: registry.sindominio.net/nginx-omeka-s
#build: "./nginx-omeka-s/"
container_name: nginx
restart: always
depends_on:
- phpfpm
networks:
- omekan
links:
- phpfpm
ports:
- "8090:80"
volumes:
- data:/sindominio
```

45
README.md Normal file
View File

@ -0,0 +1,45 @@
# Omeka S PHPFPM Docker Image
Imágen de docker de _Omeka S_ con PHPFPM
Levant el puerto 9000 para el proxy PHPFPM con el usuario _omeka_
Más info : https://omeka.org/s/
## Configuración
Variables de entorno:
* MYSQL_DATABASE omeka
* MYSQL_USER omeka
* MYSQL_PASSWORD omeka
* MYSQL_HOST db
Si hemos usado esta imagen en el docker-compose junto con la imagen de _mariadb_ debemos escribir los mismos datos.
## Uso en Docker Compose
```
...
omeka:
image: registry.sindominio.net/omeka-s
restart: always
container_name: sd_omeka_s
environment:
MYSQL_ROOT_PASSWORD: omeka
MYSQL_DATABASE: omeka
MYSQL_USER: omeka
MYSQL_PASSWORD: omeka
links:
- db
volumes:
- data:/sindominio/omeka-s
...
volumes:
data:
```

7
database.ini Normal file
View File

@ -0,0 +1,7 @@
user = "omeka"
password = "pass"
dbname = "omeka"
host = "db"
;port =
;unix_socket =
;log_path =

44
docker-compose.yml Normal file
View File

@ -0,0 +1,44 @@
version: '3'
networks:
omekan:
external: false
volumes:
db:
data:
services:
db:
image: mariadb:latest
container_name: db
networks:
- omekan
volumes:
- db:/var/lib/mysql
environment:
MYSQL_DATABASE: omeka
MYSQL_USER: omeka
MYSQL_PASSWORD: omeka
omeka-s:
image: registry.audio-lab.org/omeka-s:apache-php8.3
build:
context: .
args:
PHP_VERSION: 8.3
NODE_VERSION: 20
container_name: omeka-s
networks:
- omekan
links:
- db
volumes:
- data:/omeka
#- ./database.ini:/omeka/config/database.ini:ro
environment:
MYSQL_DATABASE: omeka
MYSQL_USER: omeka
MYSQL_PASSWORD: omeka
MYSQL_HOST: db

13
docker-entrypoint.sh Normal file
View File

@ -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 "$@"

9
envvars Normal file
View File

@ -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

58
nginx.conf Normal file
View File

@ -0,0 +1,58 @@
worker_processes auto;
pid /run/nginx/nginx.pid;
error_log stderr info;
daemon off;
master_process off;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 128;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /dev/stdout;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

12
omeka.apache2.conf Normal file
View File

@ -0,0 +1,12 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/omeka-s/
<Directory /var/www/html/omeka-s/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /dev/stdout
TransferLog /dev/stdout
</VirtualHost>

14
omeka.conf Normal file
View File

@ -0,0 +1,14 @@
[omeka]
user = omeka
group = omeka
listen = /var/run/php-fpm-omeka.sock
listen.owner = omeka
listen.group = omeka
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3