├── .gitattributes ├── LICENSE ├── app ├── Dockerfile ├── default ├── php-fpm.conf └── supervisord.conf ├── node └── Dockerfile └── start-container.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Hassan Azimi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | LABEL maintainer="Amir Azimi" 4 | 5 | ENV DEBIAN_FRONTEND=noninteractive 6 | 7 | RUN apt-get update \ 8 | && apt-get install -y gnupg tzdata \ 9 | && echo "UTC" > /etc/timezone \ 10 | && dpkg-reconfigure -f noninteractive tzdata 11 | 12 | RUN apt-get update \ 13 | && apt-get install -y curl zip unzip git supervisor sqlite3 \ 14 | nginx php7.2-fpm php7.2-cli \ 15 | php7.2-pgsql php7.2-sqlite3 php7.2-gd \ 16 | php7.2-curl php7.2-memcached \ 17 | php7.2-imap php7.2-mysql php7.2-mbstring \ 18 | php7.2-xml php7.2-zip php7.2-bcmath php7.2-soap \ 19 | php7.2-intl php7.2-readline php7.2-xdebug \ 20 | php-msgpack php-igbinary \ 21 | && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \ 22 | && mkdir /run/php \ 23 | && apt-get -y autoremove \ 24 | && apt-get clean \ 25 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ 26 | && echo "daemon off;" >> /etc/nginx/nginx.conf 27 | 28 | RUN ln -sf /dev/stdout /var/log/nginx/access.log \ 29 | && ln -sf /dev/stderr /var/log/nginx/error.log 30 | 31 | ADD default /etc/nginx/sites-available/default 32 | ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf 33 | ADD php-fpm.conf /etc/php/7.2/fpm/php-fpm.conf 34 | ADD start-container.sh /usr/bin/start-container 35 | 36 | RUN chmod +x /usr/bin/start-container 37 | 38 | ENTRYPOINT ["start-container"] 39 | -------------------------------------------------------------------------------- /app/default: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | 4 | root /var/www/html/public; 5 | 6 | index index.html index.htm index.php; 7 | 8 | server_name _; 9 | 10 | charset utf-8; 11 | 12 | location = /favicon.ico { log_not_found off; access_log off; } 13 | location = /robots.txt { log_not_found off; access_log off; } 14 | 15 | location / { 16 | try_files $uri $uri/ /index.php$is_args$args; 17 | } 18 | 19 | location ~ \.php$ { 20 | include snippets/fastcgi-php.conf; 21 | fastcgi_pass unix:/run/php/php7.2-fpm.sock; 22 | } 23 | 24 | error_page 404 /index.php; 25 | } 26 | -------------------------------------------------------------------------------- /app/php-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ;;;;;;;;;;;;;;;;;; 10 | ; Global Options ; 11 | ;;;;;;;;;;;;;;;;;; 12 | 13 | [global] 14 | ; Pid file 15 | ; Note: the default prefix is /var 16 | ; Default Value: none 17 | pid = /run/php/php7.2-fpm.pid 18 | 19 | ; Error log file 20 | ; If it's set to "syslog", log is sent to syslogd instead of being written 21 | ; into a local file. 22 | ; Note: the default prefix is /var 23 | ; Default Value: log/php-fpm.log 24 | error_log = /proc/self/fd/2 25 | 26 | ; syslog_facility is used to specify what type of program is logging the 27 | ; message. This lets syslogd specify that messages from different facilities 28 | ; will be handled differently. 29 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 30 | ; Default Value: daemon 31 | ;syslog.facility = daemon 32 | 33 | ; syslog_ident is prepended to every message. If you have multiple FPM 34 | ; instances running on the same server, you can change the default value 35 | ; which must suit common needs. 36 | ; Default Value: php-fpm 37 | ;syslog.ident = php-fpm 38 | 39 | ; Log level 40 | ; Possible Values: alert, error, warning, notice, debug 41 | ; Default Value: notice 42 | ;log_level = notice 43 | 44 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 45 | ; interval set by emergency_restart_interval then FPM will restart. A value 46 | ; of '0' means 'Off'. 47 | ; Default Value: 0 48 | ;emergency_restart_threshold = 0 49 | 50 | ; Interval of time used by emergency_restart_interval to determine when 51 | ; a graceful restart will be initiated. This can be useful to work around 52 | ; accidental corruptions in an accelerator's shared memory. 53 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 54 | ; Default Unit: seconds 55 | ; Default Value: 0 56 | ;emergency_restart_interval = 0 57 | 58 | ; Time limit for child processes to wait for a reaction on signals from master. 59 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 60 | ; Default Unit: seconds 61 | ; Default Value: 0 62 | ;process_control_timeout = 0 63 | 64 | ; The maximum number of processes FPM will fork. This has been designed to control 65 | ; the global number of processes when using dynamic PM within a lot of pools. 66 | ; Use it with caution. 67 | ; Note: A value of 0 indicates no limit 68 | ; Default Value: 0 69 | ; process.max = 128 70 | 71 | ; Specify the nice(2) priority to apply to the master process (only if set) 72 | ; The value can vary from -19 (highest priority) to 20 (lowest priority) 73 | ; Note: - It will only work if the FPM master process is launched as root 74 | ; - The pool process will inherit the master process priority 75 | ; unless specified otherwise 76 | ; Default Value: no set 77 | ; process.priority = -19 78 | 79 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 80 | ; Default Value: yes 81 | ;daemonize = yes 82 | daemonize = no 83 | 84 | ; Set open file descriptor rlimit for the master process. 85 | ; Default Value: system defined value 86 | ;rlimit_files = 1024 87 | 88 | ; Set max core size rlimit for the master process. 89 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 90 | ; Default Value: system defined value 91 | ;rlimit_core = 0 92 | 93 | ; Specify the event mechanism FPM will use. The following is available: 94 | ; - select (any POSIX os) 95 | ; - poll (any POSIX os) 96 | ; - epoll (linux >= 2.5.44) 97 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 98 | ; - /dev/poll (Solaris >= 7) 99 | ; - port (Solaris >= 10) 100 | ; Default Value: not set (auto detection) 101 | ;events.mechanism = epoll 102 | 103 | ; When FPM is built with systemd integration, specify the interval, 104 | ; in seconds, between health report notification to systemd. 105 | ; Set to 0 to disable. 106 | ; Available Units: s(econds), m(inutes), h(ours) 107 | ; Default Unit: seconds 108 | ; Default value: 10 109 | ;systemd_interval = 10 110 | 111 | ;;;;;;;;;;;;;;;;;;;; 112 | ; Pool Definitions ; 113 | ;;;;;;;;;;;;;;;;;;;; 114 | 115 | ; Multiple pools of child processes may be started with different listening 116 | ; ports and different management options. The name of the pool will be 117 | ; used in logs and stats. There is no limitation on the number of pools which 118 | ; FPM can handle. Your system will tell you anyway :) 119 | 120 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 121 | ; files from a glob(3) pattern. This directive can be used everywhere in the 122 | ; file. 123 | ; Relative path can also be used. They will be prefixed by: 124 | ; - the global prefix if it's been set (-p argument) 125 | ; - /usr otherwise 126 | include=/etc/php/7.2/fpm/pool.d/*.conf 127 | -------------------------------------------------------------------------------- /app/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | 4 | [program:nginx] 5 | command=nginx 6 | stdout_logfile=/dev/stdout 7 | stdout_logfile_maxbytes=0 8 | stderr_logfile=/dev/stderr 9 | stderr_logfile_maxbytes=0 10 | 11 | [program:php-fpm] 12 | command=php-fpm7.2 13 | stdout_logfile=/dev/stdout 14 | stdout_logfile_maxbytes=0 15 | stderr_logfile=/dev/stderr 16 | stderr_logfile_maxbytes=0 17 | -------------------------------------------------------------------------------- /node/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:latest 2 | 3 | LABEL maintainer="Amir Azimi" 4 | 5 | RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 6 | && echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \ 7 | && apt-get update \ 8 | && apt-get install -y git yarn \ 9 | && apt-get -y autoremove \ 10 | && apt-get clean \ 11 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 12 | -------------------------------------------------------------------------------- /start-container.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ ! -d /.composer ]; then 4 | mkdir /.composer 5 | fi 6 | 7 | chmod -R ugo+rw /.composer 8 | 9 | ## 10 | # Run a command or start supervisord 11 | # 12 | if [ $# -gt 0 ];then 13 | # If we passed a command, run it 14 | exec "$@" 15 | else 16 | # Otherwise start supervisord 17 | /usr/bin/supervisord 18 | fi 19 | 20 | --------------------------------------------------------------------------------