Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3 Image enhancements #81

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ The below example shows creating a `v2.2.1` release.
```
git checkout master
git checkout -b rel-2.2.1
sed -i s/master/v2.2.1/g Dockerfile
Set `ENV cachetversion=v2.2.1` in Dockerfile
git commit -am "Cachet v2.2.1 release"
git tag -a v2.2.1 -m "Cachet Release v2.2.1"
git push origin v2.2.1
```

Then to finish the process:
Then to finish the process:

* Add [Release on GitHub](https://github.com/CachetHQ/Docker/releases)
* Add automated build for the new tag on [Docker Hub](https://hub.docker.com/r/cachethq/docker/builds/)

29 changes: 18 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM debian:jessie

MAINTAINER Alt Three <support@alt-three.com>
ENV cachetversion=v2.3.0-RC2

# Using debian packages instead of compiling from scratch
RUN DEBIAN_FRONTEND=noninteractive \
Expand All @@ -9,35 +10,41 @@ RUN DEBIAN_FRONTEND=noninteractive \
apt-get clean && \
apt-get -q -y update && \
apt-get -q -y install \
ca-certificates php5-fpm=5.* php5-curl php5-readline php5-mcrypt \
ca-certificates php5-fpm=5.* php5-curl php5-readline php5-mcrypt sudo \
php5-mysql php5-apcu php5-cli php5-gd php5-mysql php5-pgsql php5-sqlite \
wget sqlite git libsqlite3-dev postgresql-client mysql-client curl supervisor cron unzip && \
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/php-fpm-pool.conf /etc/php5/fpm/pool.d/www.conf
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf

RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
RUN mkdir -p /var/www/html && \
chown -R www-data /var/www

COPY docker/crontab /etc/cron.d/artisan-schedule
COPY docker/entrypoint.sh /sbin/entrypoint.sh

RUN chmod 0644 /etc/cron.d/artisan-schedule && \
touch /var/log/cron.log

RUN adduser www-data sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

WORKDIR /var/www/html/
USER www-data

# Install composer
RUN curl -sS https://getcomposer.org/installer | php

RUN wget https://github.com/cachethq/Cachet/archive/master.tar.gz && \
tar xzvf master.tar.gz --strip-components=1 && \
RUN wget https://github.com/cachethq/Cachet/archive/${cachetversion}.tar.gz && \
tar xzvf ${cachetversion}.tar.gz --strip-components=1 && \
chown -R www-data /var/www/html && \
rm -r master.tar.gz && \
rm -r ${cachetversion}.tar.gz && \
php composer.phar install --no-dev -o

COPY docker/entrypoint.sh /sbin/entrypoint.sh
COPY docker/.env.docker /var/www/html/.env
COPY docker/crontab /etc/cron.d/artisan-schedule

RUN chmod 0644 /etc/cron.d/artisan-schedule &&\
touch /var/log/cron.log &&\
chown www-data /var/www/html/.env

VOLUME /var/www
EXPOSE 8000
Expand Down
15 changes: 8 additions & 7 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ initialize_system() {
APP_URL=${APP_URL:-http://localhost}
APP_KEY=${APP_KEY:-SECRET}

DB_DRIVER=${DB_DRIVER:-mysql}
DB_HOST=${DB_HOST:-mysql}
DB_DRIVER=${DB_DRIVER:-pgsql}
DB_HOST=${DB_HOST:-postgres}
DB_DATABASE=${DB_DATABASE:-cachet}
DB_USERNAME=${DB_USERNAME:-cachet}
DB_PASSWORD=${DB_PASSWORD:-cachet}
DB_USERNAME=${DB_USERNAME:-postgres}
DB_PASSWORD=${DB_PASSWORD:-postgres}
DB_PORT=${DB_PORT:-5432}

CACHE_DRIVER=${CACHE_DRIVER:-apc}
SESSION_DRIVER=${SESSION_DRIVER:-apc}
Expand Down Expand Up @@ -88,15 +89,15 @@ initialize_system() {
php composer.phar install --no-dev -o
php artisan app:install
rm -rf bootstrap/cache/*
touch /.cachet-installed
touch /var/www/.cachet-installed
start_system
}

start_system() {
check_database_connection
[ -f "/.cachet-installed" ] && echo "Starting Cachet" || initialize_system
[ -f "/var/www/.cachet-installed" ] && echo "Starting Cachet" || initialize_system
php artisan config:cache
exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
sudo /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf
}

case ${1} in
Expand Down
7 changes: 3 additions & 4 deletions docker/php-fpm-pool.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ listen = 9000

request_terminate_timeout = 120s

pm = dynamic
pm = ondemand
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.process_idle_timeout = 10s
pm.max_requests = 500
chdir = /

env[DB_DRIVER] = $DB_DRIVER
Expand Down
3 changes: 0 additions & 3 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)

[supervisord]
logfile=/dev/null ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=0 ; (max main logfile bytes b4 rotation;default 50MB)
Expand Down