Skip to content

Commit 6de3691

Browse files
committed
2.3 Image enhancements (#82)
* 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
1 parent a512ce3 commit 6de3691

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ The below example shows creating a `v2.2.1` release.
1818
```
1919
git checkout master
2020
git checkout -b rel-2.2.1
21-
sed -i s/master/v2.2.1/g Dockerfile
21+
Set `ENV cachetversion=v2.2.1` in Dockerfile
2222
git commit -am "Cachet v2.2.1 release"
2323
git tag -a v2.2.1 -m "Cachet Release v2.2.1"
2424
git push origin v2.2.1
2525
```
2626

27-
Then to finish the process:
27+
Then to finish the process:
2828

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

Dockerfile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,51 @@ FROM debian:jessie
22

33
MAINTAINER Alt Three <[email protected]>
44

5+
ARG cachet_ver
6+
ENV cachet_ver master
7+
58
# Using debian packages instead of compiling from scratch
69
RUN DEBIAN_FRONTEND=noninteractive \
710
echo "APT::Install-Recommends \"0\";" >> /etc/apt/apt.conf.d/02recommends && \
811
echo "APT::Install-Suggests \"0\";" >> /etc/apt/apt.conf.d/02recommends && \
912
apt-get clean && \
1013
apt-get -q -y update && \
1114
apt-get -q -y install \
12-
ca-certificates php5-fpm=5.* php5-curl php5-readline php5-mcrypt \
15+
ca-certificates php5-fpm=5.* php5-curl php5-readline php5-mcrypt sudo \
1316
php5-mysql php5-apcu php5-cli php5-gd php5-mysql php5-pgsql php5-sqlite \
1417
wget sqlite git libsqlite3-dev postgresql-client mysql-client curl supervisor cron unzip && \
1518
apt-get clean && apt-get autoremove -q && \
1619
rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man /tmp/*
1720

18-
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
1921
COPY docker/php-fpm-pool.conf /etc/php5/fpm/pool.d/www.conf
22+
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
2023

2124
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
25+
RUN mkdir -p /var/www/html && \
26+
chown -R www-data /var/www
27+
28+
COPY docker/crontab /etc/cron.d/artisan-schedule
29+
COPY docker/entrypoint.sh /sbin/entrypoint.sh
30+
31+
RUN chmod 0644 /etc/cron.d/artisan-schedule && \
32+
touch /var/log/cron.log
33+
34+
RUN adduser www-data sudo && \
35+
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
2236

2337
WORKDIR /var/www/html/
38+
USER www-data
2439

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

28-
RUN wget https://github.com/cachethq/Cachet/archive/master.tar.gz && \
29-
tar xzvf master.tar.gz --strip-components=1 && \
43+
RUN wget https://github.com/cachethq/Cachet/archive/${cachet_ver}.tar.gz && \
44+
tar xzvf ${cachet_ver}.tar.gz --strip-components=1 && \
3045
chown -R www-data /var/www/html && \
31-
rm -r master.tar.gz && \
46+
rm -r ${cachet_ver}.tar.gz && \
3247
php composer.phar install --no-dev -o
3348

34-
COPY docker/entrypoint.sh /sbin/entrypoint.sh
3549
COPY docker/.env.docker /var/www/html/.env
36-
COPY docker/crontab /etc/cron.d/artisan-schedule
37-
38-
RUN chmod 0644 /etc/cron.d/artisan-schedule &&\
39-
touch /var/log/cron.log &&\
40-
chown www-data /var/www/html/.env
4150

4251
VOLUME /var/www
4352
EXPOSE 8000

docker/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ initialize_system() {
8989
php composer.phar install --no-dev -o
9090
php artisan app:install
9191
rm -rf bootstrap/cache/*
92-
touch /.cachet-installed
92+
touch /var/www/.cachet-installed
9393
start_system
9494
}
9595

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

103103
case ${1} in

docker/php-fpm-pool.conf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ listen = 9000
66

77
request_terminate_timeout = 120s
88

9-
pm = dynamic
9+
pm = ondemand
1010
pm.max_children = 5
11-
pm.start_servers = 2
12-
pm.min_spare_servers = 1
13-
pm.max_spare_servers = 3
11+
pm.process_idle_timeout = 10s
12+
pm.max_requests = 500
1413
chdir = /
1514

1615
env[DB_DRIVER] = $DB_DRIVER

docker/supervisord.conf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[unix_http_server]
2-
file=/var/run/supervisor.sock ; (the path to the socket file)
3-
41
[supervisord]
52
logfile=/dev/null ; (main log file;default $CWD/supervisord.log)
63
logfile_maxbytes=0 ; (max main logfile bytes b4 rotation;default 50MB)

0 commit comments

Comments
 (0)