init
This commit is contained in:
parent
274ebe2761
commit
970122d167
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea/*
|
50
Dockerfile
Normal file
50
Dockerfile
Normal file
@ -0,0 +1,50 @@
|
||||
FROM php:7.4.14-cli-alpine3.13
|
||||
LABEL Maintainer="weijer <weiwei163@foxmail.com>" \
|
||||
Description="Webman Lightweight container with PHP 7.4 based on Alpine Linux."
|
||||
|
||||
# Add basics first
|
||||
RUN apk update && apk upgrade && apk add \
|
||||
bash curl ca-certificates openssl openssh git nano libxml2-dev tzdata icu-dev openntpd libedit-dev libzip-dev libjpeg-turbo-dev libpng-dev freetype-dev \
|
||||
autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c pcre-dev openssl-dev libffi-dev libressl-dev libevent-dev zlib-dev libtool automake \
|
||||
supervisor
|
||||
|
||||
RUN docker-php-ext-install soap zip pcntl sockets intl exif opcache pdo_mysql mysqli bcmath calendar gd
|
||||
|
||||
RUN pecl install -o -f redis \
|
||||
&& pecl install -o -f event \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& echo extension=event.so >> /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini \
|
||||
&& pecl clear-cache
|
||||
|
||||
RUN php -m
|
||||
|
||||
# Add Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
|
||||
|
||||
# Configure PHP
|
||||
COPY config/php.ini /usr/local/etc/php/conf.d/zzz_custom.ini
|
||||
|
||||
# Configure supervisord
|
||||
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Make sure files/folders needed by the processes are accessable when they run under the nobody user
|
||||
RUN chown -R nobody.nobody /run
|
||||
|
||||
# Setup document root
|
||||
RUN mkdir -p /app
|
||||
|
||||
# Make the document root a volume
|
||||
VOLUME /app
|
||||
|
||||
#echo " > /usr/local/etc/php/conf.d/phalcon.ini
|
||||
# Switch to use a non-root user from here on
|
||||
USER root
|
||||
|
||||
# Add application
|
||||
WORKDIR /app
|
||||
|
||||
# Expose the port nginx is reachable on
|
||||
EXPOSE 8080
|
||||
|
||||
# Let supervisord start nginx & php-fpm
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Tim de Pater
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
30
README.md
30
README.md
@ -1,2 +1,28 @@
|
||||
# docker-php-nginx-7.4
|
||||
docker-php-nginx-7.4
|
||||
# Docker PHP-FPM 7.4 & Nginx 1.16 on Alpine Linux
|
||||
Example PHP-FPM 7.4 & Nginx 1.16 setup for Docker, build on [Alpine Linux](http://www.alpinelinux.org/).
|
||||
The image is only +/- 35MB large.
|
||||
|
||||
|
||||
* Built on the lightweight and secure Alpine Linux distribution
|
||||
* Very small Docker image size (+/-35MB)
|
||||
* Uses PHP 7.4 for better performance, lower cpu usage & memory footprint
|
||||
* Optimized for 100 concurrent users
|
||||
* Optimized to only use resources when there's traffic (by using PHP-FPM's ondemand PM)
|
||||
* The servers Nginx, PHP-FPM and supervisord run under a non-privileged user (nobody) to make it more secure
|
||||
* The logs of all the services are redirected to the output of the Docker container (visible with `docker logs -f <container name>`)
|
||||
* Follows the KISS principle (Keep It Simple, Stupid) to make it easy to understand and adjust the image
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Start the Docker container:
|
||||
|
||||
docker run -p 80:8080 gsviec/nginx-php:7.4
|
||||
|
||||
See the PHP info on http://localhost, or the static html page on http://localhost/test.html
|
||||
|
||||
Or mount your own code to be served by PHP-FPM & Nginx
|
||||
|
||||
```
|
||||
docker run -p 80:8080 -v ~/my-codebase:/var/www/html gsviec/nginx-php:7.4
|
||||
```
|
||||
|
2
config/php.ini
Normal file
2
config/php.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[Date]
|
||||
date.timezone="UTC"
|
14
config/supervisord.conf
Normal file
14
config/supervisord.conf
Normal file
@ -0,0 +1,14 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/run/supervisord.pid
|
||||
|
||||
[program:webman]
|
||||
command=php /app/start.php start -d
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
autorestart=false
|
||||
startretries=0
|
Loading…
Reference in New Issue
Block a user