add dockerfile for cachet

This commit is contained in:
Gabe Conradi 2015-01-13 22:50:26 -05:00
parent 953ece00cf
commit 8cdfb215fa
3 changed files with 70 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
.git

49
Dockerfile Normal file
View File

@ -0,0 +1,49 @@
FROM php:5.4-apache
# before building
# run npm install
# run node_modules/.bin/bower install
# run node_modules/.bin/gulp
ENV DB_DRIVER=mysql \
ENV=production \
DB_DATABASE=cachet \
DB_HOST= \
DB_USERNAME= \
DB_PASSWORD=
COPY . /var/www/html/
WORKDIR /var/www/html/
# ensure the assets have been compiled
RUN for d in public/{build,css,js} ; do test ! -d public/build && \
echo "Run 'gulp' before building container" >&2 && exit 1 || : ; done
RUN apt-get update && \
apt-get install -y curl libmcrypt-dev zlib1g-dev libxml2-dev \
git sqlite libsqlite3-dev --no-install-recommends && \
rm -r /var/lib/apt/lists/*
# hardcode the Illuminate key in app/config/app.php. If you want security, feel free
# to override the key in your own container with a 'php artisan key:generate' :)
RUN sed -i "s/'key' => '\w.*/'key' => 'f20d3e5ae02125a94bd60203a4edfbde',/" app/config/app.php && \
grep key app/config/app.php
# Override the apache.conf in php:5.4-apache to point to the proper DocumentRoot
# TODO this is pretty brittle and may break if php:5.4-apache changes
RUN sed -i 's/^DocumentRoot .*/DocumentRoot \/var\/www\/html\/public/' /etc/apache2/apache2.conf && \
grep /var/www/html/public /etc/apache2/apache2.conf
# public/.htaccess needs to use rewrite to let laravel do its thang
RUN a2enmod rewrite
# install dependencies. Note: PDO and XML are already in this base image
RUN docker-php-ext-install zip && \
docker-php-ext-install mcrypt && \
docker-php-ext-install mbstring && \
docker-php-ext-install pdo_mysql
RUN curl http://pecl.php.net/get/APC-3.1.13.tgz -o /usr/src/php/ext/apc.tar.gz && \
tar xzvf /usr/src/php/ext/apc.tar.gz -C /usr/src/php/ext && \
mv /usr/src/php/ext/APC-3.1.13 /usr/src/php/ext/apc && \
docker-php-ext-install apc
RUN curl -sS https://getcomposer.org/installer | php
RUN php composer.phar install --no-dev -o

View File

@ -38,6 +38,25 @@ Cachet is currently unable to build assets under CentOS 6 and Debian Wheezy. Thi
You can now find our documentation at [https://docs.cachethq.io](https://docs.cachethq.io) or, directly at [http://cachet.readme.io](http://cachet.readme.io).
## Quickstart with Docker
Run a DB container (you can either pass in environment variables for the DB, or mount a config with -v /my/database.php:/var/www/html/app/config/database.php):
export DB_USERNAME=cachet
export DB_PASSWORD=cachet
export DB_DATABASE=cachet
docker run --name mysql -e MYSQL_USER=$DB_USERNAME -e MYSQL_PASSWORD=$DB_PASSWORD -e MYSQL_DATABASE=$DB_DATABASE -d mysql
Initialize the DB if you havent yet:
docker run --link mysql:mysql -e DB_HOST=mysql -e DB_DATABASE=$DB_DATABASE -e DB_USERNAME=$DB_USERNAME -e DB_PASSWORD=$DB_PASSWORD byxorna/cachet:test php artisan migrate
Run Cachet:
docker run -d --link mysql:mysql -p 80:80 -e DB_HOST=mysql -e DB_DATABASE=$DB_DATABASE -e DB_USERNAME=$DB_USERNAME -e DB_PASSWORD=$DB_PASSWORD byxorna/cachet:test
Now go to http://<ipdockerisboundto>/setup and have fun!
## Translations
A special thank you to our [translators](https://crowdin.com/project/cachet/activity_stream), who have allowed us to share Cachet with the world. If you'd like to contribute translations, please check out our [CrowdIn project](https://crowdin.com/project/cachet).