Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
1180a2a1bf | |||
dc20068bc8 | |||
f8f8388665 | |||
cb28a8b31a | |||
3bc5132764 | |||
3f61272b80 | |||
f9f6cbc02a | |||
89683874f4 | |||
1b7028562c | |||
f254ef8eba | |||
ec29e7f7fe | |||
bb03f89057 | |||
b90b14e271 | |||
065735999d | |||
197cfeba33 | |||
6bc615549f | |||
d8ce78bf0e | |||
1ed108bef3 | |||
8b2d17f7a2 | |||
5150ef0345 | |||
1bb0e5868e | |||
9a6b626f97 | |||
ac76fb5f14 | |||
08967db25c | |||
2b7821456b | |||
eb7c227cd2 | |||
c10669c535 | |||
b674704a31 | |||
cafd520a6c | |||
4ab2cb28f6 | |||
25959b65ca | |||
b85ef29cb6 |
100
.drone.yml
Normal file
100
.drone.yml
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build_release
|
||||||
|
image: plugins/docker
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: publish_release
|
||||||
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
from_secret: registry_username
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
from_secret: registry_password
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: build_develop
|
||||||
|
image: plugins/docker
|
||||||
|
commands:
|
||||||
|
- ./scripts/drone-build.sh
|
||||||
|
when:
|
||||||
|
branch: develop
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: publish_develop
|
||||||
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
from_secret: registry_username
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
from_secret: registry_password
|
||||||
|
commands:
|
||||||
|
- ./scripts/drone-publish.sh
|
||||||
|
when:
|
||||||
|
branch: develop
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: build_feature
|
||||||
|
image: plugins/docker
|
||||||
|
commands:
|
||||||
|
- ./scripts/drone-build.sh
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- feature_*
|
||||||
|
- develop
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: publish_feature
|
||||||
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
from_secret: registry_username
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
from_secret: registry_password
|
||||||
|
commands:
|
||||||
|
- ./scripts/drone-publish.sh
|
||||||
|
when:
|
||||||
|
branch: develop
|
||||||
|
event:
|
||||||
|
- pull_request
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: docker
|
||||||
|
image: docker:dind
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: docker-sock
|
||||||
|
temp: {}
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
.history/
|
.history/
|
||||||
|
|
||||||
|
/test
|
||||||
|
20
Dockerfile
20
Dockerfile
@ -1,17 +1,23 @@
|
|||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
RUN apk add --update --no-cache coreutils supervisor acl nginx make curl bash \
|
RUN apk add --update --no-cache coreutils supervisor acl nginx make curl bash icu-libs \
|
||||||
&& mkdir /run/nginx && mkdir /var/www/app && mkdir /run/php
|
&& mkdir -p /run/nginx && mkdir /var/www/app && mkdir /run/php
|
||||||
|
|
||||||
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
|
||||||
php7 php7-fpm php7-opcache php7-mysqli php7-json php7-openssl php7-curl php7-zlib \
|
php7 php7-fpm php7-opcache php7-mysqli php7-json php7-openssl php7-curl php7-zlib composer \
|
||||||
php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-ctype php7-session composer \
|
php7-xml php7-phar php7-intl php7-dom php7-simplexml php7-xmlreader php7-ctype php7-session \
|
||||||
php7-mbstring php7-gd php7-tokenizer php7-xmlwriter php7-fileinfo php7-pdo php7-pdo_mysql
|
php7-mbstring php7-gd php7-tokenizer php7-xmlwriter php7-fileinfo php7-pdo php7-pdo_mysql \
|
||||||
|
php7-pecl-xdebug php7-pdo_sqlite
|
||||||
|
|
||||||
COPY src/etc/ /etc/
|
COPY src/etc /etc
|
||||||
COPY src/app/ /var/www/app/
|
|
||||||
COPY src/entrypoint.sh /
|
COPY src/entrypoint.sh /
|
||||||
|
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
RUN ln -sf /dev/stdout /var/log/nginx/app_access.log \
|
||||||
|
&& ln -sf /dev/stderr /var/log/nginx/app_error.log
|
||||||
|
|
||||||
|
WORKDIR /var/www/app
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
36
scripts/drone-build.sh
Executable file
36
scripts/drone-build.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
contains() {
|
||||||
|
string="$1"
|
||||||
|
substring="$2"
|
||||||
|
if test "${string#*$substring}" != "$string"
|
||||||
|
then
|
||||||
|
return 0 # $substring is in $string
|
||||||
|
else
|
||||||
|
return 1 # $substring is not in $string
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
branch=$CI_COMMIT_BRANCH
|
||||||
|
event=$CI_BUILD_EVENT
|
||||||
|
source_branch=$DRONE_SOURCE_BRANCH
|
||||||
|
step_name=$DRONE_STEP_NAME
|
||||||
|
|
||||||
|
if { contains "$branch" "feature_" && [ "$event" = push ]; } ; then
|
||||||
|
sleep 5
|
||||||
|
docker build -t docker.pbiernat.dev/nginx-php:$branch .
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
|
||||||
|
sleep 5
|
||||||
|
docker build -t docker.pbiernat.dev/nginx-php:$source_branch .
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if { [ "$branch" = develop ] && [ "$event" = push ] && [ "$step_name" != build_feature ]; } ; then
|
||||||
|
sleep 5
|
||||||
|
docker build -t docker.pbiernat.dev/nginx-php:dev .
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
29
scripts/drone-publish.sh
Executable file
29
scripts/drone-publish.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
contains() {
|
||||||
|
string="$1"
|
||||||
|
substring="$2"
|
||||||
|
if test "${string#*$substring}" != "$string"
|
||||||
|
then
|
||||||
|
return 0 # $substring is in $string
|
||||||
|
else
|
||||||
|
return 1 # $substring is not in $string
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
branch=$CI_COMMIT_BRANCH
|
||||||
|
event=$CI_BUILD_EVENT
|
||||||
|
source_branch=$DRONE_SOURCE_BRANCH
|
||||||
|
|
||||||
|
docker login docker.pbiernat.dev -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
||||||
|
|
||||||
|
if { [ "$branch" = develop ] && [ "$event" = pull_request ]; } ; then
|
||||||
|
docker push docker.pbiernat.dev/nginx-php:$source_branch
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if { [ "$branch" = develop ] && [ "$event" = push ]; } ; then
|
||||||
|
docker push docker.pbiernat.dev/nginx-php:dev
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
php /var/www/app/artisan migrate
|
# php /var/www/app/artisan migrate
|
||||||
while [ $? -ne 0 ]; do
|
# while [ $? -ne 0 ]; do
|
||||||
php /var/www/app/artisan migrate
|
# php /var/www/app/artisan migrate
|
||||||
done
|
# done
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
# This is a default site configuration which will simply return 404, preventing
|
|
||||||
# chance access to any other virtualhost.
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
|
||||||
root /var/www/app/public;
|
root /var/www/app/public;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# try to serve file directly, fallback to index.php
|
|
||||||
try_files $uri /index.php$is_args$args;
|
try_files $uri /index.php$is_args$args;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +12,7 @@ server {
|
|||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
|
||||||
# optionally set the value of the environment variables used in the application
|
# optionally set the value of the environment variables used in the application
|
||||||
# fastcgi_param APP_ENV prod;
|
fastcgi_param APP_ENV dev;
|
||||||
# fastcgi_param APP_SECRET <app-secret-id>;
|
# fastcgi_param APP_SECRET <app-secret-id>;
|
||||||
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
|
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
|
||||||
|
|
||||||
@ -30,7 +25,8 @@ server {
|
|||||||
# for more information).
|
# for more information).
|
||||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||||
# Prevents URIs that include the front controller. This will 404:
|
|
||||||
|
# Prevents URIs that include the front controller. This will 404:
|
||||||
# http://domain.tld/index.php/some-path
|
# http://domain.tld/index.php/some-path
|
||||||
# Remove the internal directive to allow URIs like this
|
# Remove the internal directive to allow URIs like this
|
||||||
internal;
|
internal;
|
||||||
@ -44,3 +40,4 @@ server {
|
|||||||
error_log /var/log/nginx/app_error.log;
|
error_log /var/log/nginx/app_error.log;
|
||||||
access_log /var/log/nginx/app_access.log;
|
access_log /var/log/nginx/app_access.log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
[supervisord]
|
[supervisord]
|
||||||
logfile=/var/log/supervisord.log
|
logfile=/var/log/supervisord.log
|
||||||
|
pidfile=/var/run/supervisord.pid
|
||||||
nodaemon=false
|
nodaemon=false
|
||||||
|
user=root
|
||||||
|
|
||||||
[program:nginx]
|
[program:nginx]
|
||||||
command=/usr/sbin/nginx -g 'daemon off;'
|
command=/usr/sbin/nginx -g 'daemon off;'
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
priority=10
|
priority=10
|
||||||
stdout_events_enabled=true
|
stdout_logfile=/dev/stdout
|
||||||
stderr_events_enabled=true
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
command=/usr/sbin/php-fpm7 -F
|
command=/usr/sbin/php-fpm7 -F
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
priority=5
|
priority=5
|
||||||
stdout_events_enabled=true
|
stdout_logfile=/dev/stdout
|
||||||
stderr_events_enabled=true
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
Loading…
Reference in New Issue
Block a user