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 name: default
steps: steps:
# TODO: tags
- name: docker - name: docker
image: plugins/docker image: plugins/docker
settings: settings:
@ -12,6 +11,7 @@ steps:
from_secret: dockerhub_username from_secret: dockerhub_username
password: password:
from_secret: dockerhub_password from_secret: dockerhub_password
auto_tag: true
when: when:
branch: branch:
- master - master

View File

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