Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #42 from lynxluna/feature/docker-single
Browse files Browse the repository at this point in the history
Attemp to Dockerise using self-contained image
  • Loading branch information
bepitulaz authored Aug 21, 2017
2 parents 9ad42cd + 2549e56 commit 9c1e917
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/.web-server-pid
/app/config/parameters.yml
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
/web/uploads/areas/*.png
/web/uploads/areas/*.jpg
/web/uploads/areas/*.gif
/web/uploads/fields/*.png
/web/uploads/fields/*.jpg
/web/uploads/fields/*.gif
/web/uploads/seeds/*.png
/web/uploads/seeds/*.jpg
/web/uploads/seeds/*.gif
/web/uploads/areas/*.PNG
/web/uploads/areas/*.JPG
/web/uploads/areas/*.GIF
/web/uploads/fields/*.PNG
/web/uploads/fields/*.JPG
/web/uploads/fields/*.GIF
/web/uploads/seeds/*.PNG
/web/uploads/seeds/*.JPG
/web/uploads/seeds/*.GIF
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]

# Session
Session.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags

.DS_Store
docker/**/Dockerfile
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,22 @@
/web/uploads/seeds/*.GIF
/web/vendor/*
.env
composer.phar
composer.phar
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]

# Session
Session.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags

.DS_Store

docker-compose.override.yml
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
language: php

dist: trusty

sudo: required

php:
- '7.1'

install:
- cp -a .env-example .env
- composer install --no-interaction

script:
- ./vendor/bin/phpunit

after_success:
- docker build -t tanibox/tania -f docker/app/Dockerfile --build-arg BUILD_DATE="$(date +%Y-%m-%d)" .

branches:
only:
- development
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
![Tania](readme-assets/project-logo.png "Tania Logo")

[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/taniafarm/Lobby)
[![Build Status](https://travis-ci.org/Tanibox/tania.svg?branch=master)](https://travis-ci.org/Tanibox/tania)

Tania is a free and open source farming management system for everyone. You can manage your growing areas, reservoirs, farm tasks, inventories, and the crop growing progress.

Expand Down
40 changes: 40 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

version: '2.2'

services:

app:
image: tanibox/tania:latest
build:
dockerfile: docker/app/Dockerfile
context: .
environment:
SYMFONY_LOCALE: en
SYMFONY_SECRET: AugIVKlefKLzqJwlwY5S5YaW8Ui66fi8
SYMFONY_ENV: dev
SYMFONY_DB_HOST: db
SYMFONY_DB_PORT: 3306
SYMFONY_DB_NAME: tania
SYMFONY_DB_USERNAME: tania
SYMFONY_DB_PASSWORD: taniapass
SYMFONY_MAILER_TRANSPORT: smtp
SYMFONY_MAILER_HOST: 127.0.0.1
SYMFONY_MAILER_USERNAME: admin
SYMFONY_MAILER_PASSWORD: admin
SYMFONY_MAILER_FROM_ADDRESS: [email protected]
SYMFONY_MAILER_SENDER_NAME: yourname
COMPOSER_ALLOW_SUPERUSER: 1
ports:
- "80:80"
volumes:
- '.:/var/www'
- '$HOME/.composer:/var/www/.composer'
db:
image: 'mysql:5.6'
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: tania
MYSQL_USER: tania
MYSQL_PASSWORD: taniapass
ports:
- "3306:3306"
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '2.2'

services:
app:
image: tanibox/tania:latest

28 changes: 28 additions & 0 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM tanibox/php7-fpm-nginx-supervisord

MAINTAINER Didiet Noor <[email protected]>

ARG BUILD_DATE

LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Tania Web Application" \
org.label-schema.description="Build artifact for Tania" \
org.label-schema.url="http://gettania.org/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/Tanibox/tania.git" \
org.label-schema.vendor="Tania" \
org.label-schema.version="1.2-beta" \
org.label-schema.schema-version="1.0"

ADD . /var/www
COPY ./docker/app/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/app/tania-entrypoint /usr/local/bin/
VOLUME /var/www/var/cache
WORKDIR /var/www

EXPOSE 80

RUN touch /var/www/.env \
&& COMPOSER_ALLOW_SUPERUSER=1 composer install --no-autoloader --no-scripts --no-dev

ENTRYPOINT [ "/usr/local/bin/tania-entrypoint" ]
49 changes: 49 additions & 0 deletions docker/app/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
user www-data;
worker_processes 4;
pid /run/nginx.pid;
daemon off;

events {
worker_connections 2048;
multi_accept on;
use epoll;
}

http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log off;
gzip on;
gzip_disable "msie6";
open_file_cache max=100;

server {
root /var/www/web;

location / {
try_files $uri @rewriteapp;
}

location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}

error_log /dev/stdout info;
access_log /dev/stdout;
}
}
23 changes: 23 additions & 0 deletions docker/app/tania-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

composer install

chown www-data:www-data -R /var/www/var/cache
chown www-data:www-data -R /var/www/var/logs
chown www-data:www-data -R /var/www/var/sessions


if [ ! -d /tmp ]; then
mkdir -p /tmp
fi

if [ ! -e /tmp/stdout ]; then
mkfifo -m 666 /tmp/stdout
fi

cat <> /tmp/stdout 1>&2 &


# Needed for Alpine
/usr/bin/supervisord -n -c /etc/supervisord.conf

0 comments on commit 9c1e917

Please sign in to comment.