Created
July 27, 2017 15:02
-
-
Save schors/619a993215d207b8e31570f4efdb0e9a to your computer and use it in GitHub Desktop.
Environment container php 7.1 entrypiont.sh
This file contains 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 php:7.1-cli | |
RUN apt-get update && apt-get install -y \ | |
openssl \ | |
bash \ | |
locales \ | |
man \ | |
vim \ | |
curl \ | |
wget \ | |
bzip2 \ | |
mariadb-client \ | |
git \ | |
tmux \ | |
openssh-client \ | |
openssh-sftp-server | |
RUN curl -sS https://getcomposer.org/installer | php \ | |
&& mv composer.phar /usr/local/bin/ \ | |
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer | |
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/cron | |
COPY cron_entrypoint.sh /entrypoint.sh | |
COPY crontab /etc/crontab | |
RUN rm -f /cron.d/* | |
RUN ln -sf /var/opt/docker-env-etc/passwd /etc/passwd \ | |
&& ln -sf /var/opt/docker-env-etc/group /etc/group \ | |
&& ln -sf /var/opt/docker-env-etc/shadow /etc/shadow \ | |
&& ln -sf /var/opt/docker-env-etc/gshadow /etc/gshadow | |
ENTRYPOINT ["/entrypoint.sh"] | |
CMD [ "/usr/sbin/cron", "-f", "-L", "8"] | |
#!/bin/sh | |
DAEMON=crond | |
stop() { | |
echo "Received SIGINT or SIGTERM. Shutting down $DAEMON" | |
pid=$(cat /var/run/$DAEMON/$DAEMON.pid) | |
kill -SIGTERM "${pid}" | |
wait "${pid}" | |
echo "Done." | |
} | |
if [ -n "$OVERLORD_HOST" ]; then | |
echo "$OVERLORD_HOST" > /etc/debian_chroot | |
fi | |
echo "Running $@" | |
if [ "$(basename $1)" == "$DAEMON" ]; then | |
trap stop SIGINT SIGTERM | |
$@ & | |
pid="$!" | |
mkdir -p /var/run/$DAEMON && echo "${pid}" > /var/run/$DAEMON/$DAEMON.pid | |
wait "${pid}" && exit $? | |
else | |
exec "$@" | |
fi | |
# /etc/crontab: system-wide crontab | |
# Unlike any other crontab you don't have to run the `crontab' | |
# command to install the new version when you edit this file | |
# and files in /etc/cron.d. These files also have username fields, | |
# that none of the other crontabs do. | |
SHELL=/bin/sh | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
# m h dom mon dow user command | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment