Created
March 1, 2016 03:04
-
-
Save iansltx/119cae66ab1defa03762 to your computer and use it in GitHub Desktop.
runit + php7 dev server + better ctrl-c response Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.3 | |
# install packages | |
RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ | |
apk add --update php7-common@testing php7-pdo_mysql@testing \ | |
php7-pcntl@testing php7-json@testing php7-opcache@testing \ | |
php7-mbstring@testing php7-fpm@testing php7@testing nginx runit@testing | |
# set up app | |
RUN mkdir /var/app | |
COPY index.php /var/app/index.php | |
# set up runit | |
RUN mkdir -p /etc/service/php-server && echo '#!/bin/sh' >> /etc/service/php-server/run && echo 'php7 -S 0.0.0.0:80 /var/app/index.php' >> /etc/service/php-server/run && chmod +x /etc/service/php-server/run | |
COPY runsvinit /sbin/runsvinit | |
RUN chmod +x /sbin/runsvinit | |
ENTRYPOINT ["/sbin/runsvinit"] | |
# ENTRYPOINT ["/sbin/runsvdir", "/etc/service"] | |
EXPOSE 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php phpinfo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sv_stop() { | |
for s in $(ls -d /etc/service/*) | |
do | |
/sbin/sv stop $s | |
done | |
} | |
trap "sv_stop; exit" SIGTERM | |
/sbin/runsvdir /etc/service & | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment