Skip to content
Permalink
Browse files

Add docker files

  • Loading branch information...
kiwiz committed Mar 14, 2019
1 parent 9db0136 commit 1163991673a54260c334cc350c08d7c93fb0bc08
Showing with 167 additions and 2 deletions.
  1. +10 −0 .dockerignore
  2. +1 −0 411.conf
  3. +78 −0 Dockerfile
  4. +1 −1 README.md
  5. +13 −0 docker-compose-es2x.yml
  6. +13 −0 docker-compose-es5x.yml
  7. +13 −0 docker-compose-es6x.yml
  8. +37 −0 docs/Docker.md
  9. +1 −1 package.json
@@ -0,0 +1,10 @@
docs/
tests/
.git/
.phan/
.travis.yml
*.swp
.dockerignore
Dockerfile
vendor
node_modules
@@ -14,5 +14,6 @@
Options -Indexes +FollowSymLinks
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
@@ -0,0 +1,78 @@
FROM php:7-apache AS builder
ARG COMPOSER=composer-es2x.json
WORKDIR /app

RUN apt-get update && \
apt-get -y install git sqlite3 gnupg

RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer

RUN apt-get -y install unzip nodejs
RUN npm install -g grunt-cli bower

COPY . .

RUN COMPOSER=${COMPOSER} composer install --no-dev --ignore-platform-reqs --optimize-autoloader
RUN npm install
RUN bower --allow-root install
RUN grunt prod

WORKDIR /data
RUN sqlite3 /data/data.db < /app/db.sql
RUN ln -sf /data/data.db /app/data.db

RUN cp /app/config_example.php /data/config.php
RUN sed -i 's/localhost:9200/es:9200/g' /data/config.php
RUN ln -sf /data/config.php /app/config.php

RUN cp /app/411.conf /data/411.conf
RUN sed -i 's/HOSTNAME/fouroneone/g' /data/411.conf
RUN sed -i 's/# SetEnv FOURONEONEHOST/SetEnv FOURONEONEHOST/g' /data/411.conf
RUN sed -i 's$/var/www/411$/app$g' /data/411.conf

RUN cp /app/docker/supervisord.conf /data/supervisord.conf
RUN cp /app/docker/mail.ini /data/mail.ini
RUN cp /app/docker/411_cron /data/411_cron
RUN /app/docker/init.php

RUN rm -rf /app/docker


FROM php:7-apache
WORKDIR /app

RUN chown www-data:www-data .

RUN apt-get update && \
apt-get -y install \
libxml2-dev \
libcurl4-openssl-dev \
sqlite3 \
libsqlite3-dev \
cron \
supervisor

RUN docker-php-ext-configure \
pdo_mysql --with-pdo-mysql=mysqlnd
RUN docker-php-ext-install \
xml \
pdo_mysql \
pdo_sqlite \
mbstring \
curl \
pcntl

RUN a2enmod headers rewrite

COPY --chown=www-data --from=builder /app .
COPY --chown=www-data --from=builder /data /data

RUN ln -sf /data/411.conf /etc/apache2/sites-available/000-default.conf

RUN ln -sf /data/mail.ini /usr/local/etc/php/conf.d/
RUN ln -sf /data/411_cron /etc/cron.d/

VOLUME /data
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/data/supervisord.conf"]
@@ -36,7 +36,7 @@ Setup
=====

- [Setup instructions](/docs/Setup.md)
- [Docker instructions](https://github.com/kiwiz/411-docker)
- [Docker instructions](/docs/Docker.md)


Help
@@ -0,0 +1,13 @@
version: '2'
services:
fouroneone:
build:
context: .
args:
COMPOSER: composer-es2x.json
ports:
- "8080:80"
es:
image: "elasticsearch:2.4"
ports:
- "9200:9200"
@@ -0,0 +1,13 @@
version: '2'
services:
fouroneone:
build:
context: .
args:
COMPOSER: composer-es5x.json
ports:
- "8080:80"
es:
image: "elasticsearch:5.6"
ports:
- "9200:9200"
@@ -0,0 +1,13 @@
version: '2'
services:
fouroneone:
build:
context: .
args:
COMPOSER: composer-es6x.json
ports:
- "8080:80"
es:
image: "elasticsearch:6.7"
ports:
- "9200:9200"
@@ -0,0 +1,37 @@
Docker
======

How to use this image
---------------------

Make sure you're using the right branch! (This branch is for ES 2.0)

To set up just 411:
```
$ docker run -p 8080:80 kaiz/411
```
This assumes you already have an elasticsearch cluster set up with the hostname `es`.


To set up 411 and Elasticsearch (requires `docker-compose`):
```
$ docker-compose up
```


Where is data stored?
---------------------

All data is stored in `/data`, which is declared as a volume.

To customize the config, you'll need to copy the `data` directory:
```
$ DOCKER_IMAGE=$(docker create kaiz/411)
$ docker cp $DOCKER_IMAGE:/data data
$ docker rm -v $DOCKER_IMAGE
```

Make appropriate edits to the files in `data` and make sure to mount the directory:
```
$ docker run -p 8080:80 -v $(pwd)/data:/data kaiz/411
```
@@ -1,5 +1,5 @@
{
"name": "FourOneOne",
"name": "411",
"version": "1.0.0",
"description": "An Alert Management Web Application",
"main": "index.js",

0 comments on commit 1163991

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.