Compare commits

...

30 Commits

Author SHA1 Message Date
1180a2a1bf Merge pull request 'merge develop' (#20) from develop into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/20
2021-11-23 22:17:13 +00:00
dc20068bc8 Merge pull request 'Test CI/CD by FAKE PR' (#19) from feature_test_cicd into develop
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/19
2021-11-23 22:14:47 +00:00
f8f8388665 [fix] Cleanup drone scripts
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 23:13:36 +01:00
cb28a8b31a Merge pull request 'PR 'feature_cicd_fix'' (#18) from feature_cicd_fix into develop
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/18
2021-11-23 21:47:18 +00:00
3bc5132764 Merge branch 'develop' into feature_cicd_fix
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 22:45:15 +01:00
3f61272b80 [fix] Cleanup 2021-11-23 22:45:05 +01:00
f9f6cbc02a Merge pull request 'feature_cicd_fix' (#17) from feature_cicd_fix into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/17
2021-11-23 21:40:00 +00:00
89683874f4 Merge branch 'develop' into feature_cicd_fix
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 22:37:59 +01:00
1b7028562c [fix] Added missing variable 2021-11-23 22:37:43 +01:00
f254ef8eba Merge pull request 'Updated 'feature_cicd_fix'' (#16) from feature_cicd_fix into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/16
2021-11-23 21:34:51 +00:00
ec29e7f7fe Merge branch 'develop' into feature_cicd_fix
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 22:32:05 +01:00
bb03f89057 Merge branch 'develop' into feature_cicd_fix
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-23 22:28:03 +01:00
b90b14e271 Merge pull request 'feature_cicd_fix' (#15) from feature_cicd_fix into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/15
2021-11-23 21:11:15 +00:00
065735999d Merge branch 'develop' into feature_cicd_fix
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 22:10:05 +01:00
197cfeba33 [fix] Fix again 2021-11-23 15:43:30 +01:00
6bc615549f Merge pull request '[fix] Publish feature tagged image on PR open' (#11) from feature_cicd_fix into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/11
2021-11-23 14:41:32 +00:00
d8ce78bf0e [fix] Publish feature tagged image on PR open
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 15:39:20 +01:00
1ed108bef3 Merge pull request '[fix] Fixed build_develop step' (#10) from feature_test2 into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/10
2021-11-23 14:33:23 +00:00
8b2d17f7a2 [fix] Fixed build_develop step
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 15:29:27 +01:00
5150ef0345 Merge pull request 'Updated 'feature_test''
Some checks reported errors
continuous-integration/drone/push Build was killed
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/9
2021-11-23 14:07:19 +00:00
1bb0e5868e Merge branch 'develop' into feature_test
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 15:05:01 +01:00
9a6b626f97 [fix] Steps
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-23 15:03:51 +01:00
ac76fb5f14 Merge pull request 'Updated 'feature_test''
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/8
2021-11-23 14:02:25 +00:00
08967db25c Merge branch 'develop' into feature_test
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 14:59:55 +01:00
2b7821456b [feature] Build & publish dev tag after push to feature/* branch
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2021-11-23 14:51:45 +01:00
eb7c227cd2 Merge pull request '[feature] Build & publish dev tag after push to feature/* branch' (#6) from feature_test into develop
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/6
2021-11-23 13:50:31 +00:00
c10669c535 [feature] Build & publish dev tag after push to feature/* branch
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 14:47:44 +01:00
b674704a31 Merge pull request '[fix] Fixed image building config.' (#2) from develop into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: https://git.pbiernat.dev/docker/nginx-php/pulls/2
2021-11-22 23:30:55 +00:00
cafd520a6c [fix] Added sample test wwwroot and fixed default nginx conf
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2021-11-23 00:28:30 +01:00
4ab2cb28f6 [fix] Fixed image building config.
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
[add] Drone CI build and publish processes.
2021-11-22 21:03:20 +01:00
7 changed files with 177 additions and 12 deletions

100
.drone.yml Normal file
View 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
View File

@ -1 +1,3 @@
.history/ .history/
/test

View File

@ -1,7 +1,7 @@
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 composer \ php7 php7-fpm php7-opcache php7-mysqli php7-json php7-openssl php7-curl php7-zlib composer \

36
scripts/drone-build.sh Executable file
View 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
View 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

View File

@ -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,6 +25,7 @@ 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
@ -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;
} }

View File

@ -2,6 +2,7 @@
logfile=/var/log/supervisord.log logfile=/var/log/supervisord.log
pidfile=/var/run/supervisord.pid 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;'