diff --git a/Dockerfile b/Dockerfile index 53c7fc0b..1d501366 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,39 +1,41 @@ FROM debian:jessie -# Using nodesource and debian jessie packages instead of compiling from scratch +# Using debian jessie packages instead of compiling from scratch RUN DEBIAN_FRONTEND=noninteractive \ echo "APT::Install-Recommends \"0\";" >> /etc/apt/apt.conf.d/02recommends && \ echo "APT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/02recommends && \ - apt-get -qq update && \ - apt-get -qq install \ + apt-get -q -y update && \ + apt-get -q -y install \ ca-certificates nginx php5-fpm=5.* php5-curl php5-readline php5-mcrypt php5-mysql php5-apcu php5-cli \ - wget sqlite libsqlite3-dev curl supervisor cron php5-pgsql && \ - apt-get clean && apt-get autoremove -qq && \ + wget sqlite git libsqlite3-dev curl supervisor cron php5-pgsql php5-sqlite && \ + apt-get clean && apt-get autoremove -q && \ rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man /tmp/* COPY docker/supervisord.conf /etc/supervisor/supervisord.conf -COPY docker/entrypoint.sh /sbin/entrypoint.sh -RUN cd /var/www/html ;\ - wget https://github.com/cachethq/Cachet/archive/v1.1.1.tar.gz ;\ - tar xzvf v1.1.1.tar.gz --strip-components=1 +COPY docker/php-fpm-pool.conf /etc/php5/fpm/pool.d/www.conf + +# COPY docker/entrypoint.sh /sbin/entrypoint.sh WORKDIR /var/www/html/ # copy the various nginx and supervisor conf (to handle both fpm and nginx) -RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf ;\ - echo "daemon off;" >> /etc/nginx/nginx.conf ;\ - mv /var/www/html/docker/php-fpm-pool.conf /etc/php5/fpm/pool.d/www.conf ;\ - rm -f /etc/nginx/sites-enabled/* ;\ - rm -f /etc/nginx/conf.d/* ;\ - mv /var/www/html/docker/nginx-site.conf /etc/nginx/conf.d/default.conf ;\ - mv /var/www/html/docker/.env.docker /var/www/html/.env ;\ - rm -r /var/www/html/docker ;\ - chown -R www-data /var/www/html ;\ - curl -sS https://getcomposer.org/installer | php && php composer.phar install --no-dev -o - -EXPOSE 8000 - -COPY docker/crontab /etc/cron.d/artisan-schedule -RUN chmod 0644 /etc/cron.d/artisan-schedule -RUN touch /var/log/cron.log - -CMD ["/sbin/entrypoint.sh"] +RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf && \ + echo "daemon off;" >> /etc/nginx/nginx.conf && \ + rm -f /etc/nginx/sites-enabled/* && \ + rm -f /etc/nginx/conf.d/* && \ +# mv /var/www/html/docker/.env.docker /var/www/html/.env && \ +# ^ Move this to upper level of image + chown -R www-data /var/www/html && \ + curl -sS https://getcomposer.org/installer | php + +COPY docker/nginx-site.conf /etc/nginx/conf.d/default.conf + +# EXPOSE 8000 + +# COPY docker/crontab /etc/cron.d/artisan-schedule +# RUN chmod 0644 /etc/cron.d/artisan-schedule +# RUN touch /var/log/cron.log + +# ^ Also these + +CMD ["/bin/bash"] +# ^ From debian:latest, had better not run it directly diff --git a/README.md b/README.md index 70d15015..ba747600 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ -Cachet-Docker +# Cachet-Docker-Base -Run Cachet in a Docker container. - -# docker-compose -```bash -docker-compose up -``` +Base Image for cachethq/Docker +Contains configured Debian, PHP and NGINX environment diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 908842e2..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -mysql: - image: mysql:5.6 - environment: - - MYSQL_ROOT_PASSWORD=cachet - - MYSQL_DATABASE=cachet - - MYSQL_USER=cachet - - MYSQL_PASSWORD=cachet -cachet: - build: . - ports: - - 80:8000 - links: - - mysql:mysql - environment: - - DB_HOST=mysql - - DB_DATABASE=cachet - - DB_USERNAME=cachet - - DB_PASSWORD=cachet diff --git a/docker/.env.docker b/docker/.env.docker deleted file mode 100644 index fed757fa..00000000 --- a/docker/.env.docker +++ /dev/null @@ -1,27 +0,0 @@ -APP_ENV={{APP_ENV}} -APP_DEBUG={{APP_DEBUG}} -APP_URL={{APP_URL}} -APP_KEY={{APP_KEY}} - -DB_DRIVER={{DB_DRIVER}} -DB_HOST={{DB_HOST}} -DB_DATABASE={{DB_DATABASE}} -DB_USERNAME={{DB_USERNAME}} -DB_PASSWORD={{DB_PASSWORD}} - -CACHE_DRIVER={{CACHE_DRIVER}} -SESSION_DRIVER={{SESSION_DRIVER}} -QUEUE_DRIVER={{QUEUE_DRIVER}} - -MAIL_DRIVER={{MAIL_DRIVER}} -MAIL_HOST={{MAIL_HOST}} -MAIL_PORT={{MAIL_PORT}} -MAIL_USERNAME={{MAIL_USERNAME}} -MAIL_PASSWORD={{MAIL_PASSWORD}} -MAIL_ADDRESS={{MAIL_ADDRESS}} -MAIL_NAME={{MAIL_NAME}} - -REDIS_HOST={{REDIS_HOST}} -REDIS_DATABASE={{REDIS_DATABASE}} -REDIS_PORT={{REDIS_PORT}} - diff --git a/docker/crontab b/docker/crontab deleted file mode 100644 index 1b0fa150..00000000 --- a/docker/crontab +++ /dev/null @@ -1,2 +0,0 @@ -#minute hour mday month wday who command -* * * * * www-data php /var/www/html/artisan schedule:run 1>> /dev/null 2>&1 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh deleted file mode 100755 index 7792f658..00000000 --- a/docker/entrypoint.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -set -e - -APP_ENV=${APP_ENV:-local} -APP_DEBUG=${APP_DEBUG:-true} -APP_URL=${APP_URL:-http://localhost} -APP_KEY=${APP_KEY:-8NGdcb4sL46YL0LBKE5WIJaEbizHFr9R} - -DB_DRIVER=${DB_DRIVER:-mysql} -DB_HOST=${DB_HOST:-mysql} -DB_DATABASE=${DB_DATABASE:-cachet} -DB_USERNAME=${DB_USERNAME:-cachet} -DB_PASSWORD=${DB_PASSWORD:-cachet} - -CACHE_DRIVER=${CACHE_DRIVER:-file} -SESSION_DRIVER=${SESSION_DRIVER:-file} -QUEUE_DRIVER=${QUEUE_DRIVER:-database} - -MAIL_DRIVER=${MAIL_DRIVER:-smtp} -MAIL_HOST=${MAIL_HOST:-mailtrap.io} -MAIL_PORT=${MAIL_PORT:-2525} -MAIL_USERNAME=${MAIL_USERNAME:-null} -MAIL_PASSWORD=${MAIL_PASSWORD:-null} -MAIL_ADDRESS=${MAIL_ADDRESS:-null} -MAIL_NAME=${MAIL_NAME:-null} - -REDIS_HOST=${REDIS_HOST:-null} -REDIS_DATABASE=${REDIS_DATABASE:-null} -REDIS_PORT=${REDIS_PORT:-null} - -# configure env file - -sed 's,{{APP_ENV}},'"${APP_ENV}"',g' -i /var/www/html/.env -sed 's,{{APP_DEBUG}},'"${APP_DEBUG}"',g' -i /var/www/html/.env -sed 's,{{APP_URL}},'"${APP_URL}"',g' -i /var/www/html/.env -sed 's,{{APP_KEY}},'"${APP_KEY}"',g' -i /var/www/html/.env - -sed 's,{{DB_DRIVER}},'"${DB_DRIVER}"',g' -i /var/www/html/.env -sed 's,{{DB_HOST}},'"${DB_HOST}"',g' -i /var/www/html/.env -sed 's,{{DB_DATABASE}},'"${DB_DATABASE}"',g' -i /var/www/html/.env -sed 's,{{DB_USERNAME}},'"${DB_USERNAME}"',g' -i /var/www/html/.env -sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /var/www/html/.env - -sed 's,{{CACHE_DRIVER}},'"${CACHE_DRIVER}"',g' -i /var/www/html/.env -sed 's,{{SESSION_DRIVER}},'"${SESSION_DRIVER}"',g' -i /var/www/html/.env -sed 's,{{QUEUE_DRIVER}},'"${QUEUE_DRIVER}"',g' -i /var/www/html/.env - -sed 's,{{MAIL_DRIVER}},'"${MAIL_DRIVER}"',g' -i /var/www/html/.env -sed 's,{{MAIL_HOST}},'"${MAIL_HOST}"',g' -i /var/www/html/.env -sed 's,{{MAIL_PORT}},'"${MAIL_PORT}"',g' -i /var/www/html/.env -sed 's,{{MAIL_USERNAME}},'"${MAIL_USERNAME}"',g' -i /var/www/html/.env -sed 's,{{MAIL_PASSWORD}},'"${MAIL_PASSWORD}"',g' -i /var/www/html/.env -sed 's,{{MAIL_ADDRESS}},'"${MAIL_ADDRESS}"',g' -i /var/www/html/.env -sed 's,{{MAIL_NAME}},'"${MAIL_NAME}"',g' -i /var/www/html/.env - -sed 's,{{REDIS_HOST}},'"${REDIS_HOST}"',g' -i /var/www/html/.env -sed 's,{{REDIS_DATABASE}},'"${REDIS_DATABASE}"',g' -i /var/www/html/.env -sed 's,{{REDIS_PORT}},'"${REDIS_PORT}"',g' -i /var/www/html/.env - -#Clear cache -/usr/bin/php composer.phar install --no-dev -o - -echo "Starting supervisord..." -exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf - -exit 0