0
1
Fork 0

Preparing docker deployment

This commit is contained in:
Juan Ferrer 2020-01-20 22:26:15 +01:00
parent d01fb711b1
commit 21a4aee8e4
5 changed files with 85 additions and 7 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
debian
node_modules

32
Dockerfile Normal file
View File

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

View File

@ -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/
<IfModule mod_mime.c>
AddType text/x-yaml .yml
</IfModule>
<VirtualHost *:80>
DocumentRoot /usr/share/hedera-web/
</VirtualHost>
<Directory /usr/share/hedera-web/>
Options -Indexes -FollowSymLinks
AllowOverride None
@ -21,20 +25,28 @@
</FilesMatch>
</Directory>
<Directory /var/lib/hedera-web/image-db/>
<Directory /mnt/storage/image/>
Options +Indexes +FollowSymLinks
Require all granted
</Directory>
<Directory /var/lib/hedera-web/image-db/*/*>
<Directory /mnt/storage/image/*/*>
Options -Indexes -MultiViews +FollowSymLinks
AllowOverride FileInfo Options
Require all granted
<IfModule mod_headers.c>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !\.[a-zA-Z0-9]+$
RewriteRule ^(.+)$ %{REQUEST_URI}.png [L]
</IfModule>
</Directory>
<Directory /mnt/storage/vn-access>
Require all granted
AllowOverride None
Options +Indexes
IndexIgnoreReset On
Header set X-Robots-Tag "noindex, nofollow"
</Directory>

4
debian/postinst vendored
View File

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

32
docker-compose.yml Normal file
View File

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