initial
This commit is contained in:
commit
a2822445b0
34
.drone.yml
Normal file
34
.drone.yml
Normal file
@ -0,0 +1,34 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: docker
|
||||
privileged: true
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
environment:
|
||||
DOCKER_USERNAME:
|
||||
from_secret: docker_username
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: docker_password
|
||||
commands:
|
||||
- docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD} $${DOCKER_REGISTRY}
|
||||
- docker image build -f ./nginx/Dockerfile -t $${DOCKER_REGISTRY}/laravel-php-fpm/nginx ./nginx
|
||||
- docker image build -f ./php/Dockerfile -t $${DOCKER_REGISTRY}/laravel-php-fpm/php ./php
|
||||
- |
|
||||
docker image push $${DOCKER_REGISTRY}/laravel-php-fpm/nginx
|
||||
docker image push $${DOCKER_REGISTRY}/laravel-php-fpm/php
|
||||
docker image prune --force
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
11
build.sh
Executable file
11
build.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DOCKER_REGISTRY=$(1:-localhost:5000)
|
||||
|
||||
docker image build -t ${DOCKER_REGISTRY}/laravel-php-fpm/php -f php/Dockerfile ./php
|
||||
docker image build -t ${DOCKER_REGISTRY}/laravel-php-fpm/nginx -f nginx/Dockerfile ./nginx
|
||||
|
||||
[ -z "$1" ] && exit
|
||||
|
||||
docker image push ${DOCKER_REGISTRY}/laravel-php-fpm/php
|
||||
docker image push ${DOCKER_REGISTRY}/laravel-php-fpm/nginx
|
||||
7
nginx/Dockerfile
Normal file
7
nginx/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM nginx
|
||||
|
||||
ADD site.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
CMD usermod -u ${LARA_UID:-1000} nginx \
|
||||
&& groupmod -g ${LARA_GUID:-1000} nginx \
|
||||
&& nginx -g "daemon off;"
|
||||
30
nginx/site.conf
Normal file
30
nginx/site.conf
Normal file
@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
index index.php index.html;
|
||||
server_name php-docker.local;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
root /www;
|
||||
|
||||
# rewire non-files to index.php
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /www/public/$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
real_ip_header X-Forwarded-For;
|
||||
fastcgi_read_timeout 1200;
|
||||
proxy_connect_timeout 1200;
|
||||
proxy_send_timeout 1200;
|
||||
proxy_read_timeout 1200;
|
||||
send_timeout 1200;
|
||||
}
|
||||
}
|
||||
70
php/Dockerfile
Normal file
70
php/Dockerfile
Normal file
@ -0,0 +1,70 @@
|
||||
FROM ubuntu:18.04
|
||||
|
||||
# it seems -y is not enough
|
||||
ENV TERM=xterm \
|
||||
TZ=Europe/Sofia \
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
build-essential \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
curl \
|
||||
git \
|
||||
php-bcmath \
|
||||
php-ctype \
|
||||
php-curl \
|
||||
php-dev \
|
||||
php-fpm \
|
||||
php-gd \
|
||||
php-gearman \
|
||||
php-geoip \
|
||||
php-json \
|
||||
php-mbstring \
|
||||
php-memcache \
|
||||
php-memcached \
|
||||
php-mongodb \
|
||||
php-mysql \
|
||||
php-pdo \
|
||||
php-pgsql \
|
||||
php-redis \
|
||||
php-sqlite3 \
|
||||
php-xml \
|
||||
php-xmlrpc \
|
||||
php-zip \
|
||||
phpunit \
|
||||
unzip \
|
||||
wget \
|
||||
zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# setup composer 1.8.5
|
||||
RUN export COMPOSER_SHA256_SUM=4e4c1cd74b54a26618699f3190e6f5fc63bb308b13fa660f71f2a2df047c0e17 \
|
||||
&& curl "https://getcomposer.org/download/1.8.5/composer.phar" -o /usr/local/bin/composer \
|
||||
&& [ "$(sha256sum /usr/local/bin/composer | cut -d " " -f1)" = "$COMPOSER_SHA256_SUM" ] \
|
||||
&& chmod +x /usr/local/bin/composer \
|
||||
&& unset -v COMPOSER_SHA256_SUM
|
||||
|
||||
RUN ln -f -s /usr/share/zoneinfo/Europe/Sofia /etc/localtime
|
||||
|
||||
RUN mkdir -pv /run/php
|
||||
|
||||
# listen on all IPs
|
||||
RUN sed -i 's#listen = /run/php/php7.2-fpm.sock#listen = 9000#g' /etc/php/7.2/fpm/pool.d/www.conf
|
||||
|
||||
# setup composer cache
|
||||
RUN mkdir -pv /var/www/.composer
|
||||
|
||||
# setup volumes
|
||||
VOLUME /var/www/.composer
|
||||
|
||||
WORKDIR /www
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
CMD usermod -u ${LARA_UID:-1000} www-data \
|
||||
&& groupmod -g ${LARA_GUID:-1000} www-data \
|
||||
&& chown www-data:www-data -Rc /var/www/.composer \
|
||||
&& /usr/sbin/php-fpm7.2 -F
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user