Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08ed440

Browse files
committed
Added Docker support
2 parents 9f99f61 + ce87883 commit 08ed440

105 files changed

Lines changed: 6102 additions & 3530 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docker/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM php:7.3-apache
2+
RUN apt-get update && apt-get install -y libicu-dev git zip unzip && docker-php-ext-install intl && docker-php-ext-install pdo_mysql
3+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
4+
RUN git clone git://github.com/vvaswani/jade.git . && git checkout docker
5+
COPY .docker/config/php.ini "$PHP_INI_DIR/conf.d/app.ini"
6+
COPY . /var/www/html/
7+
WORKDIR /var/www/html
8+
RUN curl https://getcomposer.org/installer > composer-setup.php && php composer-setup.php
9+
RUN php composer.phar install --prefer-dist --no-scripts --no-dev --no-autoloader && rm -rf /root/.composer
10+
RUN php composer.phar dump-autoload --no-scripts --no-dev --optimize
11+
RUN rm -rf composer-setup.php composer.phar
12+
RUN apt-get remove -y libicu-dev git zip unzip && apt-get autoremove -y
13+
RUN curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /var/www/html/.docker/scripts/wait-for-it.sh && chmod +x /var/www/html/.docker/scripts/wait-for-it.sh
14+
RUN chown -R www-data:www-data /var/www/html && a2enmod rewrite
15+
EXPOSE 80

.docker/config/php.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
date.timezone = UTC
2+
post_max_size = 50M
3+
upload_max_filesize = 50M
4+
file_uploads = On
5+
intl.default_locale = en_GB

.docker/docker-compose.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: '3.5'
2+
3+
services:
4+
db:
5+
image: mariadb
6+
container_name: db
7+
restart: always
8+
environment:
9+
MYSQL_ROOT_PASSWORD: root
10+
MYSQL_DATABASE: app
11+
MYSQL_USER: app-user
12+
MYSQL_PASSWORD: app-password
13+
volumes:
14+
- db-data:/var/lib/mysql
15+
app:
16+
image: app
17+
container_name: app
18+
build:
19+
context: https://github.com/vvaswani/jade.git#master
20+
dockerfile: .docker/Dockerfile
21+
depends_on:
22+
- db
23+
ports:
24+
- "8080:80"
25+
environment:
26+
MYSQL_DATABASE: app
27+
MYSQL_USER: app-user
28+
MYSQL_PASSWORD: app-password
29+
entrypoint: ["/var/www/html/.docker/scripts/entrypoint.sh"]
30+
command: ["apache2-foreground"]
31+
volumes:
32+
- app-data:/var/www/html/data/upload
33+
networks:
34+
default:
35+
name: default-network
36+
volumes:
37+
app-data:
38+
name: app-data
39+
db-data:
40+
name: db-data

.docker/scripts/entrypoint.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# check for local configuration file
6+
# create if not already present
7+
echo "Checking for database credentials..."
8+
if [ ! -f /var/www/html/config/autoload/local.php ]; then
9+
echo "No database credentials found."
10+
echo "Creating configuration file with database credentials..."
11+
cp /var/www/html/config/autoload/local.php.dist /var/www/html/config/autoload/local.php
12+
sed -i "s/localhost/db/g" /var/www/html/config/autoload/local.php
13+
sed -i "s/app-user/$MYSQL_USER/g" /var/www/html/config/autoload/local.php
14+
sed -i "s/app-password/$MYSQL_PASSWORD/g" /var/www/html/config/autoload/local.php
15+
sed -i "s/app/$MYSQL_DATABASE/g" /var/www/html/config/autoload/local.php
16+
echo "Configuration file created."
17+
else
18+
echo "Configuration file found, skipping."
19+
fi
20+
21+
# wait for database server to become active
22+
# check for database
23+
# create if not already present
24+
if /var/www/html/.docker/scripts/wait-for-it.sh db:3306 ; then
25+
echo "Database server active."
26+
echo "Checking for database..."
27+
if ! /var/www/html/vendor/bin/doctrine-module dbal:run-sql "SELECT COUNT(*) FROM job" ; then
28+
echo "No database found."
29+
echo "Creating database schema..."
30+
/var/www/html/vendor/bin/doctrine-module -n orm:schema-tool:create
31+
echo "Loading database fixtures..."
32+
/var/www/html/vendor/bin/doctrine-module -n orm:fixtures:load
33+
else
34+
echo "Database found, skipping database creation."
35+
fi
36+
else
37+
echo "Database server inactive, skipping database checks."
38+
fi
39+
40+
# run default entrypoint commands for parent image
41+
# first arg is `-f` or `--some-option`
42+
if [ "${1#-}" != "$1" ]; then
43+
set -- apache2-foreground "$@"
44+
fi
45+
46+
exec "$@"
47+

.dockerignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
nbproject
2+
._*
3+
.~lock.*
4+
.buildpath
5+
.DS_Store
6+
.idea
7+
.project
8+
.settings
9+
composer.phar
10+
*.*~
11+
data/cache/*
12+
data/tmp/*
13+
data/upload/templates/*
14+
data/upload/jobs/*
15+
error_log
16+
.htpasswd
17+
config/autoload/local.php

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ composer.phar
1111
vendor
1212
data/cache/*
1313
data/tmp/*
14-
data/upload/*
14+
data/upload/templates/*
15+
data/upload/jobs/*
1516
error_log
1617
.htpasswd
17-
RELEASE.md
18+
RELEASE.md

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ Jade provides a standard set of tools for lawyers to manage their cases and clie
2121

2222
## Installation
2323

24-
* If you already have the components listed above, install Jade into your existing environment using this [brief guide](docs/INSTALL_ALL.md).
24+
* If you have [Docker](https://docker.com/) and [Docker Compose](https://docs.docker.com/compose/), install the application with the following commands:
2525

26-
* If you don't have the components listed above, set up the necessary environment and then install Jade into it using the detailed installation instructions for [Windows](docs/INSTALL_WINDOWS.md), [Linux](docs/INSTALL_LINUX.md) or [macOS](docs/INSTALL_MACOS.md).
26+
cd /tmp
27+
curl https://raw.githubusercontent.com/vvaswani/jade/master/.docker/docker-compose.yml > docker-compose.yml && docker-compose up
28+
29+
Browse to http://DOCKER-HOST:8080/ to access the application.
30+
31+
* If you don't have [Docker](https://docker.com/) and [Docker Compose](https://docs.docker.com/compose/) but have an environment with all the components listed above, install the application into your existing environment using this [brief guide](docs/INSTALL_ALL.md).
32+
33+
* If you don't have [Docker](https://docker.com/), [Docker Compose](https://docs.docker.com/compose/) or the components listed above, refer to the [Windows](docs/INSTALL_WINDOWS.md), [Linux](docs/INSTALL_LINUX.md) or [macOS](docs/INSTALL_MACOS.md) guides for detailed, platform-specific instructions on how to set up the necessary environment and install the application.
2734

2835
## Roadmap
2936

@@ -38,4 +45,4 @@ If you are interested in the future direction of this project, please [review th
3845

3946
## Disclaimer
4047

41-
"Jade" is a working name for this project. The final name is yet to be determined (see [issue #54](https://github.com/vvaswani/jade/issues/54)).
48+
"Jade" is a working name for this project. The final name is yet to be determined (see [issue #54](https://github.com/vvaswani/jade/issues/54)).

RELEASE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

0 commit comments

Comments
 (0)