File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM alpine:3.6
2+
3+ LABEL description "Containerized Simple PHP Contact Form" \
4+ maintainer="Kayvan Sylvan <kayvansylvan@gmail.com>"
5+
6+ ENV UID=991 GID=991
7+
8+ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.6/community" >> /etc/apk/repositories \
9+ && apk -U upgrade \
10+ && apk add -t build-dependencies \
11+ gnupg \
12+ openssl \
13+ wget \
14+ && apk add \
15+ ca-certificates \
16+ nginx \
17+ ssmtp \
18+ s6 \
19+ su-exec \
20+ php7-fpm@community \
21+ php7-curl@community \
22+ php7-iconv@community \
23+ php7-xml@community \
24+ php7-dom@community \
25+ php7-openssl@community \
26+ php7-json@community \
27+ php7-zlib@community \
28+ php7-pdo_mysql@community \
29+ php7-pdo_sqlite@community \
30+ php7-sqlite3@community \
31+ php7-ldap@community \
32+ php7-simplexml@community \
33+ && cd /tmp \
34+ && apk del build-dependencies \
35+ && rm -rf /tmp/* /var/cache/apk/* /root/.gnupg \
36+ && echo 'webform:x:991:991:Web Form:/tmp:/sbin/nologin' >> /etc/passwd
37+ # The passwd hack above is for ssmtpd to function
38+
39+ COPY nginx.conf /etc/nginx/nginx.conf
40+ COPY php-fpm.conf /etc/php7/php-fpm.conf
41+ COPY s6.d /etc/s6.d
42+ COPY run.sh /usr/local/bin/run.sh
43+ COPY contact-form /contact
44+
45+ RUN chmod +x /usr/local/bin/run.sh /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
46+
47+ VOLUME /contact/config
48+ VOLUME /etc/ssmtp
49+
50+ EXPOSE 8888
51+
52+ CMD ["run.sh" ]
Original file line number Diff line number Diff line change 22
33A Simple Contact Form developed in PHP with HTML5 Form validation. Has a fallback in JavaScript for browsers that do not support HTML5 form validation.
44
5+ ## Containerized with Alpine based container
6+
7+ Using techniques from https://github.com/hardware/rainloop
8+
9+ The container adds ssmtp so you can set up a working config in /etc/ssmtp/
10+ for the outgoing mail.
11+
512## Demo
613
714View [ demo here] ( http://www.pinceladasdaweb.com.br/blog/uploads/contact-form/ ) .
Original file line number Diff line number Diff line change 1+ worker_processes auto;
2+ pid /tmp/nginx.pid ;
3+ daemon off;
4+
5+ events {
6+ worker_connections 1024 ;
7+ use epoll;
8+ }
9+
10+ http {
11+ include /etc/nginx/mime.types ;
12+ default_type application/octet-stream ;
13+
14+ access_log off;
15+ error_log /tmp/ngx_error.log error;
16+
17+ sendfile on;
18+ keepalive_timeout 15 ;
19+ keepalive_disable msie6;
20+ keepalive_requests 100 ;
21+ tcp_nopush on;
22+ tcp_nodelay on;
23+ server_tokens off;
24+
25+ fastcgi_temp_path /tmp/fastcgi 1 2;
26+ client_body_temp_path /tmp/client_body 1 2;
27+ proxy_temp_path /tmp/proxy 1 2;
28+ uwsgi_temp_path /tmp/uwsgi 1 2;
29+ scgi_temp_path /tmp/scgi 1 2;
30+
31+ gzip on;
32+ gzip_comp_level 5;
33+ gzip_min_length 512 ;
34+ gzip_buffers 4 8k ;
35+ gzip_proxied any;
36+ gzip_vary on;
37+ gzip_disable "msie6" ;
38+ gzip_types
39+ text/css
40+ text/javascript
41+ text/xml
42+ text/plain
43+ text/x-component
44+ application/javascript
45+ application/x-javascript
46+ application/json
47+ application/xml
48+ application/rss+xml
49+ application/vnd.ms-fontobject
50+ font/truetype
51+ font/opentype
52+ image/svg+xml;
53+
54+ server {
55+ listen 8888 ;
56+ root /contact;
57+ index index .php;
58+ charset utf-8;
59+ client_max_body_size 50M ;
60+
61+ location ^~ /data {
62+ deny all;
63+ }
64+
65+ location / {
66+ try_files $uri $uri / index .php;
67+ }
68+
69+ location ~ * \.php$ {
70+ fastcgi_index index .php;
71+ fastcgi_pass unix:/tmp/php-fpm.sock;
72+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name ;
73+ include /etc/nginx/fastcgi_params;
74+ }
75+
76+ }
77+
78+ }
Original file line number Diff line number Diff line change 1+ [global]
2+ daemonize = no
3+
4+ [www]
5+ listen = /tmp/php-fpm.sock
6+ pm = dynamic
7+ pm.max_children = 5
8+ pm.start_servers = 2
9+ pm.min_spare_servers = 1
10+ pm.max_spare_servers = 3
11+ chdir = /
12+ php_admin_value[expose_php] = Off
13+ php_admin_value[post_max_size] = 50M
14+ php_admin_value[upload_max_filesize] = 50M
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ chown -R $UID :$GID /contact /etc/nginx /etc/php7 /var/log /var/lib/nginx /tmp /etc/s6.d
3+ exec su-exec $UID :$GID /bin/s6-svscan /etc/s6.d
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ exit 0
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ exec nginx
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ exec php-fpm7
You can’t perform that action at this time.
0 commit comments