docker init
This commit is contained in:
parent
74fc2802ef
commit
f276a31c92
28
docker/Dockerfile
Normal file
28
docker/Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
FROM alpine:3.10
|
||||||
|
|
||||||
|
RUN apk add --no-cache python socat wget php7-session curl git php php-curl nginx php-openssl php-mbstring php-json php-gd php-dom php-fpm
|
||||||
|
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
|
||||||
|
RUN mkdir -p /var/www
|
||||||
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
ADD rootfs/start.sh /etc/start.sh
|
||||||
|
RUN chmod +x /etc/start.sh
|
||||||
|
|
||||||
|
RUN git clone https://github.com/HaschekSolutions/opentrashmail.git
|
||||||
|
|
||||||
|
# nginx stuff
|
||||||
|
ADD rootfs/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
RUN mkdir -p /run/nginx
|
||||||
|
RUN mkdir -p /var/log/nginx
|
||||||
|
RUN sed -i 's/nobody/nginx/g' /etc/php7/php-fpm.d/www.conf
|
||||||
|
|
||||||
|
WORKDIR /var/www/opentrashmail
|
||||||
|
|
||||||
|
# Volumes to mount
|
||||||
|
#VOLUME /var/lib/influxdb
|
||||||
|
VOLUME /var/www/opentrashmail/data
|
||||||
|
|
||||||
|
EXPOSE 80 25
|
||||||
|
|
||||||
|
#CMD ["/bin/ash"]
|
||||||
|
ENTRYPOINT ["/etc/start.sh"]
|
68
docker/rootfs/nginx.conf
Normal file
68
docker/rootfs/nginx.conf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
|
||||||
|
set $base /var/www/opentrashmail;
|
||||||
|
root /var/www/opentrashmail/web/;
|
||||||
|
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
client_max_body_size 10M;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# logging
|
||||||
|
access_log /var/log/nginx/opentrashmail/web.access.log;
|
||||||
|
error_log /var/log/nginx/opentrashmail/web.error.log warn;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
# 404
|
||||||
|
try_files $fastcgi_script_name =404;
|
||||||
|
|
||||||
|
# default fastcgi_params
|
||||||
|
include fastcgi_params;
|
||||||
|
|
||||||
|
# fastcgi settings
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_buffers 8 16k;
|
||||||
|
fastcgi_buffer_size 32k;
|
||||||
|
|
||||||
|
# fastcgi params
|
||||||
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$base/:/usr/lib/php/:/tmp/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#general
|
||||||
|
# assets, media
|
||||||
|
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
|
||||||
|
expires 7d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# security headers
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||||
|
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
|
||||||
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
||||||
|
|
||||||
|
# svg, fonts
|
||||||
|
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
|
||||||
|
add_header Access-Control-Allow-Origin "*";
|
||||||
|
expires 7d;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# gzip
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
|
||||||
|
|
||||||
|
}
|
32
docker/rootfs/start.sh
Normal file
32
docker/rootfs/start.sh
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/ash
|
||||||
|
|
||||||
|
echo 'Starting Open Trashmail'
|
||||||
|
|
||||||
|
cd /var/www/opentrashmail
|
||||||
|
|
||||||
|
git pull
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo ' [+] Starting php'
|
||||||
|
php-fpm7
|
||||||
|
|
||||||
|
chown -R nginx:nginx /var/www/
|
||||||
|
|
||||||
|
echo ' [+] Starting nginx'
|
||||||
|
|
||||||
|
mkdir -p /var/log/nginx/opentrashmail
|
||||||
|
touch /var/log/nginx/opentrashmail/web.access.log
|
||||||
|
touch /var/log/nginx/opentrashmail/web.error.log
|
||||||
|
|
||||||
|
nginx
|
||||||
|
|
||||||
|
|
||||||
|
cd /var/www/opentrashmail/python
|
||||||
|
|
||||||
|
|
||||||
|
echo ' [+] Starting Mailserver'
|
||||||
|
python mailserver.py
|
||||||
|
#nohup python /var/www/opentrashmail/python/mailserver.py &
|
||||||
|
|
||||||
|
#tail -n 1 -f /var/log/nginx/*.log
|
9
docs/Docker.md
Normal file
9
docs/Docker.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Quick testing
|
||||||
|
|
||||||
|
From the `docker` directory run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t hascheksolutions/opentrashmail . && docker run --rm -it --name trashmail -p 3000:80 -p 2525:25 hascheksolutions/opentrashmail
|
||||||
|
```
|
||||||
|
|
||||||
|
And check if it works on http://localhost:3000
|
Loading…
Reference in a new issue