wordpress funcionando mas o menos
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mauro Torrez 2019-09-19 09:45:06 -03:00
parent 96f6ebf385
commit 9b04151915
3 changed files with 51 additions and 19 deletions

View File

@ -3,7 +3,6 @@ kind: pipeline
name: default
steps:
# TODO: tags
- name: docker
image: plugins/docker
settings:
@ -12,6 +11,7 @@ steps:
from_secret: dockerhub_username
password:
from_secret: dockerhub_password
auto_tag: true
when:
branch:
- master

View File

@ -1,5 +1,6 @@
ARG UNIT_VERSION=1.10.0
FROM eumau/nginx-unit:${UNIT_VERSION}-php7.3
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
@ -25,6 +26,8 @@ RUN { \
} > /etc/php/7.3/embed/conf.d/error-logging.ini
VOLUME /var/www/html
ENV WORDPRESS_VERSION 5.2.3
ENV WORDPRESS_SHA1 5efd37148788f3b14b295b2a9bf48a1a467aa303
@ -34,34 +37,63 @@ RUN set -ex; \
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress
tar -xzf wordpress.tar.gz -C /usr/src/; \
rm wordpress.tar.gz; \
chown -R www-data:www-data /usr/src/wordpress
chown -R www-data:www-data /usr/src/wordpress; \
chown -R www-data:www-data /var/www/html
# port used by the listener in config.json
EXPOSE 8080
EXPOSE 8090 8091
# application setup
RUN mkdir -p /var/www/html && echo '<?php echo phpinfo(); ' > /var/www/html/index.php && chown -R www-data:www-data /var/www/html
VOLUME /var/www/html
# launch Unit
RUN unitd --control unix:/var/run/control.unit.sock \
# upload the app config to Unit
&& curl -X PUT --data-binary '{ \
RUN \
[ -f /var/www/html/index.php ] || { \
touch /var/www/html/index.php /var/www/html/index.php.remove; \
} \
&& unitd --control unix:/var/run/control.unit.sock \
# upload the app config to Unit
&& curl -X PUT --data-binary '{ \
"listeners": { \
"*:8080": { \
"pass": "applications/wordpress" \
"*:8090": { \
"application": "script_index_php" \
}, \
"*:8091": { \
"application": "direct_php" \
} \
}, \
"applications": { \
"wordpress": { \
"script_index_php": { \
"type": "php", \
"user": "www-data", \
"group": "www-data", \
"root": "/var/www/html" \
"processes": { \
"max": 20, \
"spare": 5 \
}, \
"user": "www-data", \
"group": "www-data", \
"root": "/var/www/html", \
"script": "index.php" \
}, \
"direct_php": { \
"type": "php", \
"processes": { \
"max": 5, \
"spare": 0 \
}, \
"user": "www-data", \
"group": "www-data", \
"root": "/var/www/html", \
"script": "index.php" \
} \
} \
}' --unix-socket /var/run/control.unit.sock http://localhost/config/
}' --unix-socket /var/run/control.unit.sock http://localhost/config/ \
&& [ -f /var/www/html/index.php.remove ] && { \
rm /var/www/html/index.php /var/www/html/index.php.remove; \
}
VOLUME /www
# COPY docker-entrypoint.sh /usr/local/bin/
# ENTRYPOINT ["docker-entrypoint.sh"]
WORKDIR /var/www/html
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
STOPSIGNAL SIGTERM
CMD ["unitd", "--no-daemon", "--control", "unix:/var/run/control.unit.sock"]

2
docker-entrypoint.sh Normal file → Executable file
View File

@ -23,7 +23,7 @@ file_env() {
unset "$fileVar"
}
if [[ "$1" == unitd ]] || [ "$1" == php-fpm ]; then
if [[ "$1" == apache2* ]] || [ "$1" == unitd ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)