├── .docs └── sandbox.png ├── .editorconfig ├── Makefile ├── README.md └── sandbox ├── Caddyfile ├── Dockerfile ├── entrypoint.sh ├── php-fpm.conf └── php.ini /.docs/sandbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contributte/dockerfiles/2dd6f5d1f1cf7aa55514d4bd763aeb0a834bf029/.docs/sandbox.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | indent_style = tab 11 | indent_size = tab 12 | tab_width = 4 13 | 14 | [{*.json, *.yaml, *.yml, *.md}] 15 | indent_style = space 16 | indent_size = 2 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build dev bash 2 | 3 | build: 4 | docker build -t planette/nette sandbox 5 | 6 | dev: 7 | docker run -it --rm -p 8000:80 --name planette-nette planette/nette 8 | 9 | bash: 10 | docker exec -it planette-nette bash 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nette Docker / Nette Dockerfles 2 | 3 | 4 | 5 | Why is it useful to have Nette in container? 6 | 7 | - process isolation 8 | - multiplatform (linux, mac, windows) 9 | - configurable via ENV 10 | - plug & play 11 | 12 | In case of you're looking for a fullstack, stable, up-to-date and supported Docker solution to Nette Framework. Take a look at [Dockette](https://github.com/dockette/) or 13 | reach [@f3l1x](https://github.com/f3l1x) ([f3l1x.io](https://f3l1x.io)). 14 | 15 | There are also many docker images that could help you start with: 16 | 17 | - [dockette/web](https://github.com/dockette/web) 18 | - [dockette/php](https://github.com/dockette/php) 19 | - [dockette/ci](https://github.com/dockette/ci) 20 | - [dockette/devstack](https://github.com/dockette/devstack) 21 | - [dockette/nodejs](https://github.com/dockette/nodejs) 22 | 23 | ## Get Started 24 | 25 | This is example of nette/sandbox in Docker. Docker image is based on **Debian Buster**, 26 | there are preinstalled [PHP 7.4 FPM](https://deb.sury.org/), [Composer](https://getcomposer.org/), [Caddy server](https://caddyserver.com/) packages. 27 | 28 | ### Build 29 | 30 | You can build this image locally, using: 31 | 32 | ```bash 33 | make build 34 | ``` 35 | 36 | ```bash 37 | docker build -t nette ./sandbox 38 | ``` 39 | 40 | ### Usage 41 | 42 | ```bash 43 | make dev 44 | ``` 45 | 46 | ```bash 47 | docker run -it --rm -p 8000:80 nette 48 | ``` 49 | 50 | Now you can open `http://localhost:8000` in your browser. 51 | 52 | ### Demo 53 | 54 | ![](https://raw.githubusercontent.com/contributte/dockerfiles/master/.docs/sandbox.png "Nette Sandbox") 55 | 56 | ----- 57 | 58 | Consider to [support](https://contributte.org/partners.html) **contributte** development team. 59 | Also thank you for using this project. 60 | -------------------------------------------------------------------------------- /sandbox/Caddyfile: -------------------------------------------------------------------------------- 1 | # Listening on 2 | :80 3 | 4 | # Set the document root of the site. 5 | root * /srv/www 6 | 7 | # Compress the transmitted data 8 | encode gzip 9 | 10 | # Enable logging 11 | log 12 | 13 | # Set the path to the php-fpm process. 14 | php_fastcgi unix//var/run/php-fpm.sock 15 | 16 | # Global options 17 | { 18 | # Disable admin 19 | admin off 20 | } -------------------------------------------------------------------------------- /sandbox/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster 2 | 3 | RUN apt-get update && \ 4 | apt-get dist-upgrade -y && \ 5 | # dependencies 6 | apt-get install -y wget curl apt-transport-https ca-certificates unzip tini && \ 7 | wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \ 8 | echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list && \ 9 | echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" > /etc/apt/sources.list.d/caddy-fury.list && \ 10 | apt-get update && apt-get install -y \ 11 | curl \ 12 | git \ 13 | caddy \ 14 | php7.4-cli \ 15 | php7.4-fpm \ 16 | php7.4-gd \ 17 | php7.4-intl \ 18 | php7.4-json \ 19 | php7.4-mbstring \ 20 | php7.4-sqlite3 \ 21 | php7.4-tokenizer \ 22 | php7.4-xml \ 23 | php7.4-zip && \ 24 | # composer 25 | curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ 26 | # cleanup 27 | apt-get remove -y wget && \ 28 | apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && \ 29 | rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/* 30 | 31 | ADD ./Caddyfile /etc/Caddyfile 32 | ADD ./php.ini /etc/php/7.4/conf.d/999-php.ini 33 | ADD ./php-fpm.conf /etc/php/7.4/php-fpm.conf 34 | ADD ./entrypoint.sh /entrypoint.sh 35 | 36 | RUN composer create-project nette/sandbox /srv && \ 37 | chmod 0777 /srv/temp && \ 38 | chmod 0777 /srv/log && \ 39 | rm -rf /srv/tests 40 | 41 | WORKDIR /srv 42 | 43 | ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"] 44 | -------------------------------------------------------------------------------- /sandbox/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | /usr/sbin/php-fpm7.4 -F -R -y /etc/php/7.4/php-fpm.conf & 5 | caddy run -config /etc/Caddyfile & 6 | wait -n -------------------------------------------------------------------------------- /sandbox/php-fpm.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | 3 | error_log = /proc/self/fd/2 4 | daemonize = yes 5 | 6 | [www] 7 | 8 | ; if we send this to /proc/self/fd/1, it never appears 9 | access.log = /proc/self/fd/2 10 | 11 | user = www-data 12 | group = www-data 13 | 14 | listen = /var/run/php-fpm.sock 15 | listen.owner = www-data 16 | listen.group = www-data 17 | listen.mode = 0660 18 | 19 | pm = dynamic 20 | pm.max_children = 9 21 | pm.start_servers = 3 22 | pm.min_spare_servers = 2 23 | pm.max_spare_servers = 3 24 | pm.max_requests = 200 25 | catch_workers_output = yes 26 | clear_env = no 27 | 28 | php_admin_value[error_log] = /var/log/php-fpm.log 29 | php_admin_value[open_basedir]= "/tmp:/var/tmp:/var/www:/srv" 30 | php_admin_value[upload_tmp_dir] = "/tmp" -------------------------------------------------------------------------------- /sandbox/php.ini: -------------------------------------------------------------------------------- 1 | ; Update memory 2 | memory_limit = 521M 3 | upload_max_filesize = 256M 4 | post_max_size = 256M 5 | 6 | ; Dates 7 | date.timezone=Europe/Prague 8 | 9 | ; Mailer 10 | ;sendmail_path = /usr/local/bin/phpmailer 11 | 12 | ; No disabled functions 13 | ;disable_functions = 14 | --------------------------------------------------------------------------------