diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..ebf83b0b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +debian +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..6e94dc9a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM debian:buster-slim + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + ca-certificates \ + gnupg2 \ + && curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \ + && echo "deb http://apt.verdnatura.es/ jessie main" \ + > /etc/apt/sources.list.d/vn.list \ + && apt-get update \ + && apt-get install -y --no-install-recommends \ + apache2 \ + libapache2-mod-php \ + && rm -rf /var/lib/apt/lists/* \ + && . /etc/apache2/envvars \ + && ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \ + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \ + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" + +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ + && apt-get install -y --no-install-recommends nodejs \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update \ + && apt-get install -y hedera-web \ + && rm -rf /var/lib/apt/lists/* + +RUN a2dissite 000-default + +CMD ["apachectl", "-D", "FOREGROUND"] diff --git a/apache.conf b/apache.conf index 8c60fbfe..0786c077 100644 --- a/apache.conf +++ b/apache.conf @@ -1,10 +1,14 @@ -# Alias /hedera-web /usr/share/hedera-web/ -# Alias /image-db /var/lib/hedera-web/image-db/ +Alias /image-db /mnt/storage/image/ +Alias /vn-access /mnt/storage/vn-access/ AddType text/x-yaml .yml + + DocumentRoot /usr/share/hedera-web/ + + Options -Indexes -FollowSymLinks AllowOverride None @@ -21,20 +25,28 @@ - + Options +Indexes +FollowSymLinks Require all granted - + Options -Indexes -MultiViews +FollowSymLinks AllowOverride FileInfo Options Require all granted - + RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !\.[a-zA-Z0-9]+$ RewriteRule ^(.+)$ %{REQUEST_URI}.png [L] + + + Require all granted + AllowOverride None + Options +Indexes + IndexIgnoreReset On + Header set X-Robots-Tag "noindex, nofollow" + diff --git a/debian/postinst b/debian/postinst index f9a46109..7609a380 100755 --- a/debian/postinst +++ b/debian/postinst @@ -10,6 +10,6 @@ then apache2_invoke enconf hedera-web.conf fi -service php7.3-fpm restart -service cron restart +#service php7.3-fpm restart +#service cron restart diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..e2e5a2e3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3.7' +services: + back: + image: registry.verdnatura.es/hedera-web + build: + context: . + dockerfile: Dockerfile + ports: + - ${PORT:?}:80 + configs: + - source: config + target: /etc/hedera-web/config.my.php + - source: test + target: /etc/hedera-web/config.test.php + - source: apache + target: /etc/apache/conf-enabled/vn-share.conf + volumes: + - /mnt/storage/image:/mnt/storage/image + - /mnt/storage/vn-access:/mnt/storage/vn-access + - /mnt/storage/share:/mnt/storage/share + deploy: + replicas: 2 +configs: + config: + external: true + name: ${PROJECT_NAME:?}_config + test: + external: true + name: ${PROJECT_NAME:?}_test + apache: + external: true + name: ${PROJECT_NAME:?}_apache \ No newline at end of file