mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-01 12:07:26 +01:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7623fceadf | ||
|
|
375f40c710 | ||
|
|
4ca9be0a6a | ||
|
|
72c23cea15 | ||
|
|
aec8f75414 | ||
|
|
12f011d7ea | ||
|
|
1e6c272b04 | ||
|
|
771f647873 | ||
|
|
7ce608aeff | ||
|
|
77098587a3 | ||
|
|
706fb0fe2c | ||
|
|
ee1f2f6e09 | ||
|
|
27bdd0ec1a | ||
|
|
e53f60dad8 | ||
|
|
b0162488bd | ||
|
|
7caf8c9ea8 | ||
|
|
230856e526 | ||
|
|
1e2bb5744f | ||
|
|
54004f3038 | ||
|
|
9e8717d6d8 | ||
|
|
5ba03e8ccf | ||
|
|
dd9fea1a33 | ||
|
|
4f79c894e6 | ||
|
|
5820915a50 | ||
|
|
7c1a352676 | ||
|
|
ce2dd38f9d | ||
|
|
6c67e98f79 | ||
|
|
72ee5ef29e | ||
|
|
e81f46b9e0 | ||
|
|
bbf20d1390 | ||
|
|
12a6120734 | ||
|
|
2b1923ea7f | ||
|
|
5c9495cabd | ||
|
|
9b649269c7 | ||
|
|
22ea880d1a | ||
|
|
a1037c8459 | ||
|
|
64f7c71fde | ||
|
|
9c57f7ac04 | ||
|
|
5fea425fa9 | ||
|
|
746df6f8a5 | ||
|
|
f7d12106ec | ||
|
|
9e9f86b02f | ||
|
|
f53573d200 | ||
|
|
cef311c024 | ||
|
|
ee81a9d181 | ||
|
|
bd9e15fb3e | ||
|
|
7b040d5343 | ||
|
|
f9c7390138 | ||
|
|
3b801b876c | ||
|
|
56f713bcd3 | ||
|
|
17344e3d47 | ||
|
|
352059a10b | ||
|
|
fec1d175f9 | ||
|
|
8a28648b90 | ||
|
|
96266d42c6 | ||
|
|
5533d5a58a | ||
|
|
951fc81b3e |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
||||
data
|
||||
21
Dockerfile
21
Dockerfile
@@ -1,18 +1,25 @@
|
||||
FROM php:fpm
|
||||
FROM php:7.0-fpm
|
||||
|
||||
MAINTAINER Samuel Laulhau <sam@lalop.co>
|
||||
|
||||
#####
|
||||
# SYSTEM REQUIREMENT
|
||||
#####
|
||||
ENV PHANTOMJS phantomjs-2.1.1-linux-x86_64
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libmcrypt-dev zlib1g-dev git libgmp-dev \
|
||||
libfreetype6-dev libjpeg62-turbo-dev libpng12-dev \
|
||||
build-essential chrpath libssl-dev libxft-dev \
|
||||
libfreetype6 libfontconfig1 libfontconfig1-dev \
|
||||
&& ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/local/include/ \
|
||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||
&& docker-php-ext-configure gmp \
|
||||
&& docker-php-ext-install iconv mcrypt mbstring pdo pdo_mysql zip gd gmp \
|
||||
&& curl -o ${PHANTOMJS}.tar.bz2 -SL https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOMJS}.tar.bz2 \
|
||||
&& tar xvjf ${PHANTOMJS}.tar.bz2 \
|
||||
&& mv ${PHANTOMJS} /usr/local/share \
|
||||
&& ln -sf /usr/local/share/${PHANTOMJS}/bin/phantomjs /usr/local/bin \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#####
|
||||
@@ -25,7 +32,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
|
||||
# DOWNLOAD AND INSTALL INVOICE NINJA
|
||||
#####
|
||||
|
||||
ENV INVOICENINJA_VERSION 2.5.2.2
|
||||
ENV INVOICENINJA_VERSION 3.0.4
|
||||
|
||||
RUN curl -o invoiceninja.tar.gz -SL https://github.com/hillelcoren/invoice-ninja/archive/v${INVOICENINJA_VERSION}.tar.gz \
|
||||
&& tar -xzf invoiceninja.tar.gz -C /var/www/ \
|
||||
@@ -34,6 +41,7 @@ RUN curl -o invoiceninja.tar.gz -SL https://github.com/hillelcoren/invoice-ninja
|
||||
&& chown -R www-data:www-data /var/www/app \
|
||||
&& composer install --working-dir /var/www/app -o --no-dev --no-interaction --no-progress \
|
||||
&& chown -R www-data:www-data /var/www/app/bootstrap/cache \
|
||||
# && echo ${INVOICENINJA_VERSION} > /var/www/app/storage/version.txt \
|
||||
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
|
||||
&& mv /var/www/app/public/logo /var/www/app/docker-backup-public-logo
|
||||
|
||||
@@ -43,9 +51,14 @@ RUN curl -o invoiceninja.tar.gz -SL https://github.com/hillelcoren/invoice-ninja
|
||||
######
|
||||
ENV DB_HOST mysql
|
||||
ENV DB_DATABASE ninja
|
||||
ENV DB_USERNAME ninja
|
||||
ENV DB_PASSWORD ninja
|
||||
ENV APP_KEY SomeRandomString
|
||||
ENV LOG errorlog
|
||||
ENV APP_DEBUG 1
|
||||
ENV APP_DEBUG 0
|
||||
ENV APP_CIPHER rijndael-128
|
||||
ENV SELF_UPDATER_SOURCE ''
|
||||
ENV PHANTOMJS_BIN_PATH /usr/local/bin/phantomjs
|
||||
|
||||
|
||||
#use to be mounted into nginx for exemple
|
||||
@@ -53,8 +66,6 @@ VOLUME /var/www/app/public
|
||||
|
||||
WORKDIR /var/www/app
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
COPY app-entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
|
||||
50
README.md
50
README.md
@@ -2,28 +2,34 @@ DockerFile for invoice ninja (https://www.invoiceninja.com/)
|
||||
|
||||
This image is based on `php:7` official version.
|
||||
|
||||
The easiest way to try this image is via docker compose :
|
||||
The easiest way to test Invoice Ninja with docker is by copying the example directory, run `docker-compose up` and visit http://localhost:8000/ .
|
||||
The first launch could be slow because we create all tables and seed the database, but once youe see `NOTICE: ready to handle connections` all is ready.
|
||||
|
||||
To make your data persistent, you have to mount `/var/www/app/public/logo` and `/var/www/app/storage`.
|
||||
|
||||
All the supported environment variable can be found here https://github.com/invoiceninja/invoiceninja/blob/master/.env.example
|
||||
|
||||
|
||||
### Usage
|
||||
|
||||
To run it:
|
||||
|
||||
```
|
||||
db:
|
||||
image: mysql
|
||||
environment:
|
||||
MYSQL_DATABASE: ninja
|
||||
MYSQL_ROOT_PASSWORD: mdp
|
||||
|
||||
app:
|
||||
image: invoiceninja/invoiceninja
|
||||
links:
|
||||
- db:mysql
|
||||
|
||||
web:
|
||||
image: nginx
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
links:
|
||||
- app
|
||||
volumes_from:
|
||||
- app
|
||||
ports:
|
||||
- 80
|
||||
docker run -d
|
||||
-e APP_ENV='production'
|
||||
-e APP_DEBUG=0
|
||||
-e APP_URL='http://ninja.dev'
|
||||
-e APP_KEY='SomeRandomStringSomeRandomString'
|
||||
-e APP_CIPHER='AES-256-CBC'
|
||||
-e DB_TYPE='mysql'
|
||||
-e DB_STRICT='false'
|
||||
-e DB_HOST='localhost'
|
||||
-e DB_DATABASE='ninja'
|
||||
-e DB_USERNAME='ninja'
|
||||
-e DB_PASSWORD='ninja'
|
||||
-p '80:80'
|
||||
invoiceninja/invoiceninja
|
||||
```
|
||||
A list of environment variables can be found [here](https://github.com/invoiceninja/invoiceninja/blob/master/.env.example)
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
|
||||
# if we're linked to MySQL, and we're using the root user, and our linked
|
||||
# container has a default "root" password set up and passed through... :)
|
||||
: ${DB_USERNAME:=root}
|
||||
if [ "$DB_USERNAME" = 'root' ]; then
|
||||
: ${DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
|
||||
fi
|
||||
|
||||
echo "DB_USERNAME=$DB_USERNAME" >> .env
|
||||
echo "DB_PASSWORD=$DB_PASSWORD" >> .env
|
||||
|
||||
if [ ! -d /var/www/app/storage ]; then
|
||||
cp -Rp /var/www/app/docker-backup-storage /var/www/app/storage
|
||||
else
|
||||
@@ -34,6 +23,34 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
chown www-data .env
|
||||
# widely inspired from https://github.com/docker-library/wordpress/blob/c674e9ceedf582705e0ad8487c16b42b37a5e9da/fpm/docker-entrypoint.sh#L128
|
||||
TERM=dumb php -- "$DB_HOST" "$DB_USERNAME" "$DB_PASSWORD" "$DB_DATABASE" <<'EOPHP'
|
||||
<?php
|
||||
$stderr = fopen('php://stderr', 'w');
|
||||
list($host, $port) = explode(':', $argv[1], 2);
|
||||
$maxTries = 20;
|
||||
do {
|
||||
try {
|
||||
$connection = new Pdo("mysql:dbname={$argv[4]};host={$host};port={$port}", $argv[2], $argv[3]);
|
||||
fwrite($stderr, 'MySQL ready'. "\n");
|
||||
exit(0);
|
||||
} catch (PDOException $e) {
|
||||
fwrite($stderr, 'MySQL Connection Error: ' . $e->getMessage(). "\n");
|
||||
if (--$maxTries <= 0) {
|
||||
exit(1);
|
||||
}
|
||||
sleep(3);
|
||||
}
|
||||
} while (true);
|
||||
EOPHP
|
||||
|
||||
#php artisan optimize --force
|
||||
#php artisan migrate --force
|
||||
|
||||
#if [ ! -e "/var/www/app/is-seeded" ]; then
|
||||
#php artisan db:seed --force
|
||||
#touch "/var/www/app/is-seeded"
|
||||
#fi
|
||||
|
||||
echo 'start'
|
||||
exec "$@"
|
||||
|
||||
13
example/.env
Normal file
13
example/.env
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
APP_DEBUG=1
|
||||
APP_URL=http://localhost:8000
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=pwd
|
||||
DB_HOST=mysql
|
||||
MAIL_HOST=mail.service.host
|
||||
MAIL_USERNAME=username
|
||||
MAIL_PASSWORD=password
|
||||
MAIL_DRIVER=smtp
|
||||
MAIL_FROM_NAME="My name"
|
||||
MAIL_FROM_ADDRESS=user@mail.com
|
||||
43
example/docker-compose.yml
Normal file
43
example/docker-compose.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: mysql
|
||||
environment:
|
||||
MYSQL_DATABASE: ninja
|
||||
MYSQL_ROOT_PASSWORD: pwd
|
||||
|
||||
app:
|
||||
image: invoiceninja/invoiceninja
|
||||
links:
|
||||
- db:mysql
|
||||
env_file: .env
|
||||
|
||||
web:
|
||||
image: nginx
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
links:
|
||||
- app
|
||||
volumes_from:
|
||||
- app
|
||||
ports:
|
||||
- 8000:80
|
||||
|
||||
cron:
|
||||
image: invoiceninja/invoiceninja
|
||||
links:
|
||||
- db:mysql
|
||||
env_file: .env
|
||||
volumes_from:
|
||||
- app
|
||||
entrypoint: |
|
||||
bash -c 'bash -s <<EOF
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
sleep 300s
|
||||
while /bin/true; do
|
||||
/usr/local/bin/php /var/www/app/artisan ninja:send-invoices
|
||||
/usr/local/bin/php /var/www/app/artisan ninja:send-reminders
|
||||
sleep 1d
|
||||
done
|
||||
EOF'
|
||||
Reference in New Issue
Block a user