Skip to content

Commit

Permalink
2.3 Image enhancements (#82)
Browse files Browse the repository at this point in the history
* Use PgSQL default (#78) (#79)

* Use PgSQL default

* change DB_HOST default

* Image enhancements and best practices

* Set to master version

* enable cachet_ver ARG for build time version override
  • Loading branch information
djdefi committed May 27, 2016
1 parent a512ce3 commit 6de3691
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
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/)

31 changes: 20 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,51 @@ FROM debian:jessie

MAINTAINER Alt Three <support@alt-three.com>

ARG cachet_ver
ENV cachet_ver master

# Using debian 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 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/${cachet_ver}.tar.gz && \
tar xzvf ${cachet_ver}.tar.gz --strip-components=1 && \
chown -R www-data /var/www/html && \
rm -r master.tar.gz && \
rm -r ${cachet_ver}.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
6 changes: 3 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,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

0 comments on commit 6de3691

Please sign in to comment.