Compare commits

...

119 Commits

Author SHA1 Message Date
codedge
e2d6cbd853 Merge pull request #155 from codedge/fix-wrong-tag
Fix wrong tag
2020-05-29 16:44:01 +02:00
Holger Lösken
21cc3ddf2c Fix wrong tag 2020-05-29 16:43:40 +02:00
Holger Lösken
8245a57117 Support docker secrets via _FILE 2020-05-29 09:23:20 +02:00
Holger Lösken
6b25f47ba1 Match db container to default env values 2020-05-29 09:23:20 +02:00
Holger Lösken
1168dec11b WIP: Implement docker secrets 2020-05-29 09:23:20 +02:00
Samuel Laulhau
f81e0c8f11 add bug report templates 2020-05-28 23:19:57 +02:00
Samuel Laulhau
3e2d5a4f8c Update issue templates 2020-05-28 23:18:33 +02:00
codedge
42e2c2234e Merge pull request #152 from codedge/docker-for-v5
Build docker images for v5
2020-05-28 10:27:32 +02:00
Holger Lösken
4e05229fed Fix missing php exts, do not run migrate and seed 2020-05-28 10:24:50 +02:00
Holger Lösken
c5fb1ab64b Remove db host 2020-05-27 19:12:58 +02:00
Holger Lösken
b190c8e633 Built multi stage image for v5 2020-05-27 19:08:42 +02:00
Holger Lösken
4350619c64 Update tags for v5 2020-05-26 23:04:49 +02:00
Holger Lösken
a38b398d5d Build docker images for v5 2020-05-26 22:55:29 +02:00
codedge
3f8fb906b5 Merge pull request #151 from codedge/fix-arg-scoping
Fix wrong argument scope, pull correct IN version
2020-05-25 21:53:55 +02:00
Holger Lösken
8962e0d0b9 Fix wrong argument scope, pull correct IN version 2020-05-25 21:51:27 +02:00
codedge
fc6923ad40 Merge pull request #148 from codedge/permissions
Add permission instructions
2020-05-23 18:07:40 +02:00
Holger Lösken
3b907d6093 Add permission instructions 2020-05-23 18:07:22 +02:00
codedge
431f11ccd4 Merge pull request #147 from codedge/fix-badge
Fix badge
2020-05-23 10:34:09 +02:00
Holger Lösken
2de45a45ab Fix badge 2020-05-23 10:33:38 +02:00
Holger Lösken
6037ebf2c2 Add some badges fix workflow 2020-05-22 21:33:38 +02:00
Holger Lösken
685801983a Remove phantomjs
PhantomJS does not work for alpine, use cloud version
2020-05-21 22:30:00 +02:00
Holger Lösken
f1a5f6fc7b Remove checks for running entrypoint 2020-05-21 22:30:00 +02:00
Holger Lösken
6cbdec0686 Remove unused env var 2020-05-21 22:30:00 +02:00
Holger Lösken
4c855161f6 Fixed missing maintainer 2020-05-21 22:30:00 +02:00
Holger Lösken
1447268f94 Fix wrong path for entrypoint 2020-05-21 22:30:00 +02:00
Holger Lösken
c0c13705ae PhantomJS works on alpine 2020-05-21 22:30:00 +02:00
Holger Lösken
11869a23a1 Adjusted makefile and workflow to build alpine and debian image 2020-05-21 22:30:00 +02:00
Holger Lösken
39bc2f0d89 Missing merged changes from PR #140 2020-05-21 22:30:00 +02:00
Holger Lösken
0ff6e56ed8 Format readme, shorten the docker command 2020-05-21 22:30:00 +02:00
Holger Lösken
ac5f1bfad5 Base setup for building images via gh actions 2020-05-21 22:30:00 +02:00
Samuel Laulhau
fb064cb05e merge improve-docker-compose 2020-05-18 12:39:18 +02:00
Holger Lösken
a84ec51b3f Restructure docker-compose
* Use alpine images
* Remove separate directory
* Give more hints in docker-compose file
2020-05-18 12:37:35 +02:00
Holger Lösken
e2cafb8b72 Fix text 2020-05-18 12:13:10 +02:00
Holger Lösken
672fc41611 Stackoverflow for getting help 2020-05-18 12:13:10 +02:00
Holger Lösken
eeffc2191c Update instructions, restore log driver 2020-05-12 10:29:07 +02:00
Holger Lösken
8a6622bbbb Explanation how view log files
Fix #137

* Better description how to find log files
* Change default log to file but can be overridden by env var
2020-05-12 10:29:07 +02:00
Holger Lösken
4f3f7ca8fe Make use of .env.example values 2020-05-11 22:43:58 +02:00
Holger Lösken
9e8db1b5bd Update docs for PhantomJS key 2020-05-11 22:43:58 +02:00
Holger Lösken
6bcfd57208 Add link to phantomjs docs 2020-05-11 22:43:58 +02:00
Holger Lösken
db9e0f4309 Update README.md
Fix #71

* Update readme with details how to generate secret keys - application key and phantomjs
* Integrated mounting persistence folder into docker command
2020-05-11 22:43:58 +02:00
Samuel Laulhau
cb91ba9973 4.5.18 2020-04-01 07:14:44 +02:00
Justin Hammond
9060027999 Update README.md 2020-01-06 17:05:09 +01:00
Samuel Laulhau
26c91935fc fix fpm port in exemple
fix #117
2019-12-22 17:51:27 +01:00
Dan Bright
7c5275e766 Update entrypoint.sh
Fix a tiny, insignificant typo in a comment.
2019-12-20 17:26:31 +01:00
Samuel Laulhau
482b30b677 4.5.17 2019-12-03 16:34:22 +01:00
Susanne Gerber
7a45036c72 fix small spelling error 2019-10-29 15:33:19 +01:00
Samuel Laulhau
a963db2b63 4.5.16 2019-10-28 09:31:53 +01:00
Robin Chan
26a71f7f1f if web starts first without app, nginx will quit 2019-10-13 21:01:40 +02:00
Sam
af98f696b9 3.5.15 2019-10-08 10:09:00 +02:00
Martin Honermeyer
696d3b356a Unzip quietly 2019-09-19 09:38:01 +02:00
Samuel Laulhau
0ef00831f6 use stretch image
this is a work around for freetype on buster
2019-07-23 09:46:07 +02:00
Sam
6ba1f11221 4.5.14 2019-07-22 09:46:45 +02:00
Geoffroy Empain
933748e15b Use the correct docker host for mysql
`mysql` is not a valid host. The container name is `db` as specified by the `docker-compose.yml`.
2019-07-05 09:53:23 +02:00
Sam
03180fc65e 4.5.13 2019-05-27 10:35:50 +02:00
Stanislav Shupilkin
e0fcb50ecb Update docker-compose.yml 2019-03-27 14:34:16 +01:00
Stanislav Shupilkin
5c418c474e Change Dockerfile, remove deprecated MAINTAINER section, separate stage on two 2019-03-27 14:34:16 +01:00
Sam
5e59ec10e3 4.5.12 2019-03-26 09:59:53 +01:00
Sam
6b0182e712 4.5.11 2019-03-04 21:04:24 +01:00
Sam
961282a90e 4.5.10 2019-02-21 10:46:35 +01:00
Sam
3a17d81cab 4.5.9 2019-01-23 10:30:24 +01:00
Sam
a3bb9b9681 4.5.8 2019-01-08 12:40:44 +01:00
Sam
766b604971 4.5.7 2018-12-11 15:49:01 +01:00
Andreas Treubert
005e1b9dfe Little bugfix for docker run example within readme 2018-11-14 10:21:20 +01:00
Sam
8d0a39ac71 4.5.6 2018-11-09 11:12:38 +01:00
Sam
6e12296f25 4.5.5 2018-09-28 09:45:22 +02:00
Sam
dbac9305c9 4.5.4 2018-09-10 15:41:27 +02:00
Anojh Thayaparan
3c96683d46 Cron should be run every day not every hour 2018-09-04 10:29:55 +02:00
Sam
279a282d44 4.5.3 2018-08-20 21:00:55 +02:00
Sam
e0332086d4 4.5.2 2018-08-08 23:06:15 +02:00
Sam
63ffa18860 chmod entrypoint in repo 2018-07-29 16:55:52 +02:00
Sam
960c3172e9 remove old env in alpine 2018-07-29 16:52:39 +02:00
Sam
43ff450c2d avoid using copy --from in alpine 2018-07-29 16:49:39 +02:00
Sam
aaa6118286 remove "ln gmp.h" command in alpine 2018-07-29 16:33:11 +02:00
Sam
1ab7bc02d6 4.5.1 2018-07-19 18:48:16 +02:00
Sam
9625d9d9d0 4.5.0 2018-07-09 11:09:25 +02:00
Sam
3bd5324136 chown mounted dir 2018-07-04 22:07:24 +02:00
Sam
e28c8dc07b 4.4.4 2018-06-11 09:12:30 +02:00
Sam
4ab4039887 4.4.3 2018-05-15 20:08:35 +02:00
Sam
650851811a chown backup 2018-05-10 10:03:25 +02:00
Sam
72762dc964 4.4.2 2018-05-03 09:41:03 +02:00
Sam
dc66ca0544 4.4.1 2018-04-30 16:21:31 +02:00
Sam
52992d622b use mysql 5 in docker-compose 2018-04-30 16:21:00 +02:00
Sam
9dcf825f85 chown .env 2018-04-25 14:15:04 +02:00
Sam
350a9fad35 4.4.0 2018-04-25 09:59:49 +02:00
Sam
d8ca192f8e use official Invoice Ninja package 2018-04-24 15:16:33 +02:00
Sam
b6d213682d composer optim 2018-04-24 10:06:13 +02:00
Sam
0d88a6268f fix nginx and mysql version in docker-compose 2018-04-24 10:05:47 +02:00
Sam
c641680309 optim dockerfile 2018-04-23 18:06:28 +02:00
Sam
47116c7d78 add DB_DATABASE in docker-compose exemple 2018-04-23 18:06:19 +02:00
Sam
41544ec1e0 4.3.1 2018-04-09 11:53:45 +02:00
Sam
f3b5a62d36 4.3.0 2018-04-08 10:13:25 +02:00
Sam
69d2f54b03 php 7.2 2018-04-05 14:29:10 +02:00
Sam
5a1c1c16d7 fix clean composer 2018-04-04 16:57:39 +02:00
Sam
3ade74efc9 fix Dockerfile 2018-04-04 12:46:21 +02:00
Sam
dc00f6a604 rm composer after build 2018-04-04 12:30:58 +02:00
Sam
3ef75b29ff 4.2.2 2018-03-12 10:05:06 +01:00
Sam
e6df981f06 4.2.1 2018-03-05 09:44:34 +01:00
Aurélien Lavorel
27bdb5d95b [add] mysql performance improvement 2018-02-28 17:46:22 +01:00
Sam
206fe5db2d 4.2.0 2018-02-22 10:03:01 +01:00
Samuel Laulhau
4e5022fcc4 remove useless and/or wrong default settings 2018-02-20 15:01:24 +01:00
Sam
ded7e32051 4.1.5 2018-02-07 22:10:59 +01:00
Sam
d2ae9b365b 4.1.4 2018-01-25 22:02:05 +01:00
Sam
612645fad2 4.1.3 2018-01-19 15:56:49 +01:00
Sam
192f6d7648 4.1.2 2018-01-16 21:45:53 +01:00
Sam
083fe9648e 4.1.1 2018-01-16 21:45:26 +01:00
Sam
6ad5e6ec48 fix readme for image base 2018-01-14 22:53:25 +01:00
Sam
13487557e6 docker-compose for production 2018-01-14 22:44:20 +01:00
Sam
16f77b069e 4.1.0 2018-01-09 19:05:50 +01:00
Sam
58c4eb66d4 4.0.1 2017-12-14 22:28:01 +01:00
Sam
d044303647 4.0.0 2017-12-12 10:42:04 +01:00
Sam
09b5b84750 3.9.2 2017-11-20 10:36:53 +01:00
Sam
2932f92f4c 3.9.1 2017-11-14 15:24:03 +01:00
Sam
3ad282ac29 re3.9.0 2017-11-09 14:01:23 +01:00
Sam
507451d7ca 3.9.0 2017-11-09 13:53:53 +01:00
Sam
2d563e4b73 3.8.1 2017-10-23 14:39:16 +02:00
Sam
991b22e121 3.8.0 2017-10-15 15:01:13 +02:00
jelle
c4e8f3ea0b Mount MySQL volume to make data persistent 2017-10-15 14:53:13 +02:00
Samuel Laulhau
ee272cd52f add cipher/key 2017-10-15 14:51:01 +02:00
Sam
a60567ae16 3.7.2 2017-10-02 10:23:24 +02:00
18 changed files with 810 additions and 319 deletions

24
.editorconfig Normal file
View File

@@ -0,0 +1,24 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*.*]
charset = utf-8
# Tab indentation (no size specified)
[Makefile]
indent_style = tab
# Matches the files *.yml
[*.yml]
indent_style = space
indent_size = 2

26
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
# Before creating an issue
Be sure the issue isn't yet reported here or dicussed on stackoverflow
# Logs
Did you check the logs ?
If any Error is present there please copy/paste it below
```
Any Error that sucks
```
# Setup information
What version do you run?
Do you run docker-compose or a single Dockerfile ?

41
.github/workflows/build_push.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Docker images
on:
release:
types: [published]
jobs:
deploy:
name: Build images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Login to DockerHub
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Get the latest tag
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Build image from alpine - v5
run: make build-alpine-v5 TAG="${{steps.vars.outputs.tag}}"
- name: Push alpine-based image - v5
run: make push-alpine-v5 TAG="${{steps.vars.outputs.tag}}"
- name: Build image from alpine - v4
run: make build-alpine TAG="${{steps.vars.outputs.tag}}"
- name: Push alpine-based image - v4
run: make push-alpine TAG="${{steps.vars.outputs.tag}}"
- name: Build image from debian - v4
run: make build-debian TAG="${{steps.vars.outputs.tag}}"
- name: Push debian-based image - v4
run: make push-debian TAG="${{steps.vars.outputs.tag}}"
- name: Logout from DockerHub
run: docker logout

View File

@@ -1,85 +0,0 @@
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 opcache \
&& curl -o ${PHANTOMJS}.tar.bz2 -SL https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOMJS}.tar.bz2 \
&& tar xvjf ${PHANTOMJS}.tar.bz2 \
&& rm ${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/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
#####
# INSTALL COMPOSER
#####
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#####
# DOWNLOAD AND INSTALL INVOICE NINJA
#####
ENV INVOICENINJA_VERSION 3.7.1
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/ \
&& rm invoiceninja.tar.gz \
&& mv /var/www/invoiceninja-${INVOICENINJA_VERSION} /var/www/app \
&& 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 \
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
&& mv /var/www/app/public /var/www/app/docker-backup-public \
&& rm -rf /var/www/app/docs /var/www/app/tests
######
# DEFAULT ENV
######
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 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
VOLUME /var/www/app/public
WORKDIR /var/www/app
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]

76
Makefile Normal file
View File

@@ -0,0 +1,76 @@
ifndef TAG
$(error The TAG variable is missing.)
endif
# Docker Hub namespace
HUB_NAMESPACE="invoiceninja"
# Image name
IMAGE="invoiceninja"
# Check if v5 tag is passed, so that a v5 version should be built
IS_V5=$(shell echo ${TAG} | egrep ^5)
# Building docker images based on alpine.
# Assigned tags:
# - :alpine
# - :alpine-<RELEASE VERSION>
.PHONY: build-alpine
build-alpine:
ifeq ($(IS_V5),)
$(info Make: Building "$(TAG)" tagged images from alpine.)
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile .
# Tag as alpine-4
@docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG} ${HUB_NAMESPACE}/${IMAGE}:alpine-4
$(info Make: Done.)
endif
.PHONY: push-alpine
push-alpine:
ifeq ($(IS_V5),)
$(info Make: Pushing tagged images from alpine.)
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-${TAG}
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-4
$(info Make: Done.)
endif
.PHONY: build-alpine-v5
build-alpine-v5:
ifneq ($(IS_V5),)
$(info Make: Building "$(TAG)" tagged images from alpine.)
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./alpine/Dockerfile_v5 .
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:5
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${TAG} ${HUB_NAMESPACE}/${IMAGE}:latest
$(info Make: Done.)
endif
.PHONY: push-alpine-v5
push-alpine-v5:
ifneq ($(IS_V5),)
$(info Make: Pushing tagged images from alpine.)
@docker push ${HUB_NAMESPACE}/${IMAGE}:${TAG}
@docker push ${HUB_NAMESPACE}/${IMAGE}:5
@docker push ${HUB_NAMESPACE}/${IMAGE}:latest
endif
# Building docker images based on debian.
# Assigned tags:
# - :latest
# - :<RELEASE VERSION>
.PHONY: build-debian
build-debian:
ifeq ($(IS_V5),)
$(info Make: Building "$(TAG)" tagged images from debian.)
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${TAG} --build-arg INVOICENINJA_VERSION=${TAG} --file ./debian/Dockerfile .
$(info Make: Done.)
endif
.PHONY: push-debian
push-debian:
ifeq ($(IS_V5),)
$(info Make: Pushing tagged images from debian.)
@docker push ${HUB_NAMESPACE}/${IMAGE}:${TAG}
@docker push ${HUB_NAMESPACE}/${IMAGE}:latest
$(info Make: Done.)
endif

189
README.md
View File

@@ -1,37 +1,180 @@
DockerFile for invoice ninja (https://www.invoiceninja.com/)
![Docker images](https://github.com/invoiceninja/dockerfiles/workflows/Docker%20images/badge.svg)
[![Docker image, latest](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/latest?label=latest)](https://hub.docker.com/r/invoiceninja/invoiceninja)
[![Docker image, alpine](https://img.shields.io/docker/image-size/invoiceninja/invoiceninja/alpine?label=alpine)](https://hub.docker.com/r/invoiceninja/invoiceninja)
This image is based on `php:7` official version.
# Docker for [Invoice Ninja](https://www.invoiceninja.com/)
The easiest way to test Invoice Ninja with docker is by copying the example directory, run `docker-compose up` and visit http://localhost:8000/ .
:bulb: Please consider posting your question on [StackOverflow](https://stackoverflow.com/) as this widens the audience that can help you. Just use the tag `invoice-ninja` and we are there to help. This is mostly related to the usage of Invoice Ninja and the docker setup.
If you feel your question is directly related to a code change or you want to sent in a change + PR Github is the right place, of course.
To make your data persistent, you have to mount `/var/www/app/public/logo` and `/var/www/app/storage`.
:crown: **Features**
All the supported environment variable can be found here https://github.com/invoiceninja/invoiceninja/blob/master/.env.example
:lock: Automatic HTTPS (:heart: [Caddy](https://caddyserver.com/))
:hammer: Fully production-ready through docker-compose
:pencil: Adjustable to your needs via environment variable
### Usage
## Prerequisites
### Generate an application key
Before starting Invoice Ninja via Docker make sure you generate a valid application key. If you are not sure what an application key is, please visit [this blog post](https://tighten.co/blog/app-key-and-you/).
To generate an application just run
```shell
docker run --rm -it invoiceninja/invoiceninja php artisan key:generate --show
```
This will generate an application key for you which you need later.
### Create folders for data persistence
To make your data persistent, you have to mount `public` and `storage` from your host to your containers.
1. Create two folder on your host, e. g. `/var/invoiceninja/public` and `/var/invoiceninja/storage`
2. Mount these folders into your container - see [usage](#usage)
You can create these folders wherever you want on your host system.
:warning: When using host mounted folder for persistence, make sure they are owned by the proper user and group. As we run Invoice Ninja without `root` , we use a separate user, the folders on the host system need to be owned by uid `1000` and a gid `1001`.
Run this on your host system
```shell
chown -R 1000:101 /var/invoiceninja/public /var/invoiceninja/storage
```
to apply the proper permission to the folders. This also applies to the `docker-compose` setup when using [bind-mounted host directories](https://github.com/invoiceninja/dockerfiles/blob/master/docker-compose.yml#L17).
### PhantomJS key
The PhantomJS key is set to `a-demo-key-with-low-quota-per-ip-address`. This demo key is limited to 100 requests per day.
To set a different key feel free to add `-e PHANTOMJS_CLOUD_KEY='<INSERT YOUR PHANTOMJS KEY HERE>'` to thee docker command below.
For further configuration and toubleshotting regarding PhantomJS and Invoice Ninja [see documentation here](https://docs.invoiceninja.com/configure.html?#phantomjs).
## Usage
To run it:
```
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'
```shell
docker run -d \
-v /var/invoiceninja/public:/var/app/public \
-v /var/invoiceninja/storage:/var/app/storage \
-e APP_URL='http://ninja.dev' \
-e APP_KEY='<INSERT THE GENERATED APPLICATION KEY HERE>' \
-e DB_HOST='localhost' \
-e DB_DATABASE='ninja' \
-e DB_USERNAME='ninja' \
-e DB_PASSWORD='ninja' \
-p '9000:9000' \
invoiceninja/invoiceninja
```
A list of environment variables can be found [here](https://github.com/invoiceninja/invoiceninja/blob/master/.env.example)
A list of environment variables can be found [here](https://github.com/invoiceninja/invoiceninja/blob/master/.env.example).
### Know issue
### With docker-compose
Phantomjs doesn't work on linux alpine https://github.com/ariya/phantomjs/issues/14186
Running Invoice Ninja with docker-compose gives you everything to quickly start. Before starting please make sure you configured your setup correctly. You can do so by opening the `docker-compose.yml` and may change the follwing items.
**Port**
_default: 80_
This is the port where your Invoice Ninja is reachable, when you type in `http://<your-domain.com>`. If it should be different than `80` make sure to call your installation `http://<your-domain.com>:<YOUR-PORT>`, e. g. `http://<your-domain.com>:8080`.
```yml
ports:
- "8080:80" # To run it on port 8080
```
:warning: Make sure the port set is available and not occupied by another service on your host system.
**URL and application key**
_default: https://localhost_
For generating a proper application key see [generate an application key](#generate-an-application-key). Change the value where your Invoice Ninja installation should be reachable.
```yml
environment:
- APP_URL=http://localhost
````
**MYSQL root password**
_default: ninjaAdm1nPassword_
The mysql database server comes with two users: one for accessing the Invoice Ninja database and the `root` user. Please change the default password for `root` to something more special :wink:
**Volumes and directories**
_default: volumes_
This is the place where your uploaded files are stored. Normally this is a so called _volume_ which can be reused by different docker containers. One might prefer to store the files directly on the host system - for this the config section is prepared with what is called _bind-mounted host directory_. Just adjust the paths and Invoice Ninja stores the user files on the host system.
```yml
volumes:
...
# Configure your mounted directories, make sure the folder 'public' and 'storage'
# exist, before mounting them
#- public:/var/www/app/public
#- storage:/var/www/app/storage
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
- ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated
```
The sample above stores the files on the post at `./docker/app/public` and `./docker/app/storage`.
:warning: If using bind-mounted host directories make sure they exists and have proper rights. See [here](#create-folders-for-data-persistence) for details.
## Docker secrets
:information_source: This feature is borrowed from [mariadb docker image](https://hub.docker.com/_/mariadb).
As an alternative to passing sensitive information via environment variables, `_FILE` may be appended to the below listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in _/run/secrets/<secret_name>_ files.
Supported are these variables:
`APP_KEY`, `API_SECRET`, `CLOUDFLARE_API_KEY`, `DB_USERNAME`, `DB_PASSWORD`, `MAIL_USERNAME`, `MAIL_PASSWORD`, `MAILGUN_SECRET`, `S3_KEY`, `S3_SECRET`
## Debugging your Docker setup
Even when running your Invoice Ninja setup with Docker - errors can occur. Depending on where the error happens - the webserver, Invoice Ninja or the database - different log files can be responsible.
### Show logs without `docker-compose`
If you are not running `docker-compose` you first need to find the container id for your php container with `docker ps`. Then you can run
```shell
docker logs -f <CONTAINER NAME>
```
This gives you a constant output of the log files for the php container.
### Show logs with `docker-compose`
If you are running the `docker-compose` setup you can output all logs, from all containers, with the following command
```shell
docker-compose logs -f
```
If you better want a physical log file in in your `storage/logs` folder, just add `-e LOG=single` to the [usage](#usage) command.
Or add an environment variable
```yml
...
environment:
LOG: single
...
```
to your `docker-compose.yml`.
This generated log file will only hold Invoice Ninja information.

View File

@@ -1,83 +1,78 @@
FROM php:7.0-fpm-alpine
ARG PHP_VERSION=7.2
MAINTAINER Samuel Laulhau <sam@lalop.co>
FROM php:${PHP_VERSION}-fpm-alpine
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
#####
# SYSTEM REQUIREMENT
#####
ENV PHANTOMJS phantomjs-2.1.1-linux-x86_64
RUN apk update \
&& apk add --no-cache libmcrypt-dev git gmp-dev freetype-dev libjpeg-turbo-dev \
coreutils chrpath fontconfig libpng-dev
RUN 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 opcache \
&& echo "php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED">>/usr/local/etc/php-fpm.d/www.conf
RUN cd /usr/share \
&& curl -L https://github.com/Overbryd/docker-phantomjs-alpine/releases/download/2.11/phantomjs-alpine-x86_64.tar.bz2 | tar xj \
&& ln -s /usr/share/phantomjs/phantomjs /usr/local/bin/phantomjs
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
#####
# INSTALL COMPOSER
#####
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#####
# DOWNLOAD AND INSTALL INVOICE NINJA
#####
ENV INVOICENINJA_VERSION 3.7.1
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/ \
&& rm invoiceninja.tar.gz \
&& mv /var/www/invoiceninja-${INVOICENINJA_VERSION} /var/www/app \
&& 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 \
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
&& mv /var/www/app/public /var/www/app/docker-backup-public \
&& rm -rf /var/www/app/docs /var/www/app/tests
######
# DEFAULT ENV
######
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 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
VOLUME /var/www/app/public
ARG INVOICENINJA_VERSION
WORKDIR /var/www/app
COPY entrypoint.sh /usr/local/bin/invoice-entrypoint
# RUN chmod +x /usr/local/bin/invoice-entrypoint
COPY entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
ENTRYPOINT ["invoice-entrypoint"]
CMD ["php-fpm"]
RUN set -eux; \
apk add --no-cache \
gmp-dev \
freetype-dev \
libarchive-tools \
libjpeg-turbo-dev \
libpng-dev \
libwebp-dev\
libzip-dev
RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include --with-webp-dir=/usr/include --with-freetype-dir=/usr/include/; \
docker-php-ext-configure zip --with-libzip; \
docker-php-ext-install -j$(nproc) \
iconv \
gd \
gmp \
mbstring \
opcache \
pdo \
pdo_mysql \
zip
COPY ./config/php/php.ini /usr/local/etc/php/php.ini
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
# Separate user
ENV IN_USER=invoiceninja
RUN addgroup -S "$IN_USER" && \
adduser \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
--ingroup "$IN_USER" \
--no-create-home \
"$IN_USER"; \
addgroup "$IN_USER" www-data; \
chown -R "$IN_USER":"$IN_USER" .
USER $IN_USER
# Download and install IN
ENV INVOICENINJA_VERSION="${INVOICENINJA_VERSION}"
RUN curl -s -o /tmp/ninja.zip -SL https://download.invoiceninja.com/ninja-v${INVOICENINJA_VERSION}.zip \
&& bsdtar --strip-components=1 -C /var/www/app -xf /tmp/ninja.zip \
&& rm /tmp/ninja.zip \
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
&& mv /var/www/app/public /var/www/app/docker-backup-public \
&& mkdir -p /var/www/app/public/logo /var/www/app/storage \
&& cp /var/www/app/.env.example /var/www/app/.env \
&& chmod -R 755 /var/www/app/storage \
&& rm -rf /var/www/app/docs /var/www/app/tests
# Override the environment settings from projects .env file
ENV LOG errorlog
ENV SELF_UPDATER_SOURCE ''
# Use to be mounted into nginx
VOLUME /var/www/app/public
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

95
alpine/Dockerfile_v5 Normal file
View File

@@ -0,0 +1,95 @@
ARG PHP_VERSION=7.3
# Get Invoice Ninja
FROM alpine:latest as base
ARG INVOICENINJA_VERSION
RUN set -eux; \
apk add --no-cache \
curl \
libarchive-tools; \
mkdir -p /var/www/app
RUN curl -o /tmp/ninja.tar.gz -LJ0 https://github.com/invoiceninja/invoiceninja/tarball/v$INVOICENINJA_VERSION \
&& bsdtar --strip-components=1 -C /var/www/app -xf /tmp/ninja.tar.gz \
&& rm /tmp/ninja.tar.gz \
&& cp -R /var/www/app/storage /var/www/app/docker-backup-storage \
&& cp -R /var/www/app/public /var/www/app/docker-backup-public \
&& mkdir -p /var/www/app/public/logo /var/www/app/storage \
&& cp /var/www/app/.env.example /var/www/app/.env \
&& cp /var/www/app/.env.dusk.example /var/www/app/.env.dusk.local \
&& rm -rf /var/www/app/docs /var/www/app/tests
# Install nodejs packages
FROM node:12-alpine as frontend
COPY --from=base /var/www/app /var/www/app
WORKDIR /var/www/app/
RUN npm install
# Prepare php image
FROM php:${PHP_VERSION}-fpm-alpine
ARG INVOICENINJA_VERSION
ENV INVOICENINJA_VERSION=$INVOICENINJA_VERSION
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
WORKDIR /var/www/app
COPY --from=frontend /var/www/app /var/www/app
COPY entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
RUN set -eux; \
apk add --no-cache \
freetype-dev \
gmp-dev \
libjpeg-turbo-dev \
libpng-dev \
libzip-dev; \
docker-php-ext-configure zip --with-libzip; \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/; \
docker-php-ext-install -j$(nproc) \
bcmath \
exif \
gd \
gmp \
mbstring \
mysqli \
opcache \
pdo \
pdo_mysql \
zip
COPY ./config/php/php.ini /usr/local/etc/php/php.ini
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
## Separate user
ENV INVOICENINJA_USER=invoiceninja
RUN addgroup -S "$INVOICENINJA_USER" && \
adduser \
--disabled-password \
--gecos "" \
--home "$(pwd)" \
--ingroup "$INVOICENINJA_USER" \
--no-create-home \
"$INVOICENINJA_USER"; \
addgroup "$INVOICENINJA_USER" www-data; \
chown -R "$INVOICENINJA_USER":"$INVOICENINJA_USER" /var/www/app
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer; \
composer global require hirak/prestissimo;
USER $INVOICENINJA_USER
RUN composer install --no-dev --no-suggest --no-progress
# Override the environment settings from projects .env file
ENV APP_ENV production
ENV LOG errorlog
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

7
config/caddy/Caddyfile Normal file
View File

@@ -0,0 +1,7 @@
{$APP_URL} {
root * /var/www/app/public
php_fastcgi app:9000
encode zstd gzip
templates
file_server browse
}

18
config/php/php-cli.ini Normal file
View File

@@ -0,0 +1,18 @@
session.auto_start = Off
short_open_tag = Off
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
opcache.enable_cli=1
opcache.fast_shutdown=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
# http://symfony.com/doc/current/performance.html
realpath_cache_size = 4096K
realpath_cache_ttl = 600
memory_limit = 2G
post_max_size = 6M
upload_max_filesize = 5M

17
config/php/php.ini Normal file
View File

@@ -0,0 +1,17 @@
session.auto_start = Off
short_open_tag = Off
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
opcache.enable_cli=1
opcache.fast_shutdown=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
# http://symfony.com/doc/current/performance.html
realpath_cache_size = 4096K
realpath_cache_ttl = 600
post_max_size = 6M
upload_max_filesize = 5M

76
debian/Dockerfile vendored Normal file
View File

@@ -0,0 +1,76 @@
ARG PHP_VERSION=7.2
FROM php:${PHP_VERSION}-fpm-stretch
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
#####
# SYSTEM REQUIREMENT
#####
ARG INVOICENINJA_VERSION
COPY ./debian/entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
ENV BUILD_DEPS \
zlib1g-dev \
git \
libgmp-dev \
unzip \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
build-essential \
chrpath \
libssl-dev \
libxft-dev \
libfreetype6 \
libfontconfig1 \
libfontconfig1-dev
RUN apt-get update \
&& apt-get install -y --no-install-recommends $BUILD_DEPS \
&& 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 mbstring pdo pdo_mysql zip gd gmp opcache
ENV PHANTOMJS phantomjs-2.1.1-linux-x86_64
# Install PHANTOMJS
RUN curl -o ${PHANTOMJS}.tar.bz2 -SL https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOMJS}.tar.bz2 \
&& tar xvjf ${PHANTOMJS}.tar.bz2 \
&& rm ${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/*
COPY ./config/php/php.ini /usr/local/etc/php/php.ini
COPY ./config/php/php-cli.ini /usr/local/etc/php/php-cli.ini
# Download and install IN
ENV INVOICENINJA_VERSION="${INVOICENINJA_VERSION}"
RUN curl -o ninja.zip -SL https://download.invoiceninja.com/ninja-v${INVOICENINJA_VERSION}.zip \
&& unzip -q ninja.zip -d /var/www/ \
&& rm ninja.zip \
&& mv /var/www/ninja /var/www/app \
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
&& mv /var/www/app/public /var/www/app/docker-backup-public \
&& mkdir -p /var/www/app/public/logo /var/www/app/storage \
&& cp /var/www/app/.env.example /var/www/app/.env \
&& chmod -R 755 /var/www/app/storage \
&& chown -R www-data:www-data /var/www/app/storage /var/www/app/bootstrap /var/www/app/public/logo /var/www/app/.env /var/www/app/docker-backup-storage /var/www/app/docker-backup-public\
&& rm -rf /var/www/app/docs /var/www/app/tests /var/www/ninja
# Override the environment settings from projects .env file
ENV LOG errorlog
ENV SELF_UPDATER_SOURCE ''
ENV PHANTOMJS_BIN_PATH /usr/local/bin/phantomjs
# use to be mounted into nginx for example
VOLUME /var/www/app/public
WORKDIR /var/www/app
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
if [ ! -d /var/www/app/storage ]; then
@@ -30,6 +30,10 @@ if [ ! -e /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /
echo $INVOICENINJA_VERSION > /var/www/app/public/version
fi
# fix permission for mounted directories
chown www-data:www-data /var/www/app/storage
chown www-data:www-data /var/www/app/public/logo
#php artisan optimize --force
#php artisan migrate --force

92
docker-compose.yml Normal file
View File

@@ -0,0 +1,92 @@
version: '3.7'
services:
server:
image: caddy:alpine
restart: always
environment:
- APP_URL=https://localhost
volumes:
# Vhost configuration
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
# Configure your mounted directories, make sure the folder 'public' and 'storage'
# exist, before mounting them
- public:/var/www/app/public
- storage:/var/www/app/storage
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/app/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on:
- app
# Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied
ports:
- "80:80"
- "443:443"
networks:
- invoiceninja
app:
image: invoiceninja/invoiceninja:5
restart: always
environment:
- APP_URL=https://localhost
- APP_KEY=<INSERT THE GENERATED APPLICATION KEY HERE>
- MULTI_DB_ENABLED=false
- DB_HOST1=db
volumes:
# Configure your mounted directories, make sure the folder 'public' and 'storage'
# exist, before mounting them
- public:/var/www/app/public
- storage:/var/www/app/storage
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/app/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on:
- db
networks:
- invoiceninja
db:
image: mysql:5
restart: always
environment:
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=db-ninja-01
volumes:
- mysql-data:/var/lib/mysql:rw
# you may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/mysql/data:/var/lib/mysql:rw,delegated
networks:
- invoiceninja
# cron:
# image: invoiceninja/invoiceninja
# volumes:
# - storage:/var/www/app/storage
# - logo:/var/www/app/public/logo
# - public:/var/www/app/public
# entrypoint: |
# bash -c 'bash -s <<EOF
# trap "break;exit" SIGHUP SIGINT SIGTERM
# sleep 300s
# while /bin/true; do
# ./artisan ninja:send-invoices
# ./artisan ninja:send-reminders
# sleep 1d
# done
# EOF'
# networks:
# - invoiceninja
volumes:
mysql-data:
public:
storage:
networks:
invoiceninja:

126
entrypoint.sh Normal file → Executable file
View File

@@ -1,42 +1,110 @@
#!/bin/bash
#!/usr/bin/env sh
set -e
if [ ! -d /var/www/app/storage ]; then
cp -Rp /var/www/app/docker-backup-storage /var/www/app/storage
else
IN_STORAGE_BACKUP="$(ls /var/www/app/docker-backup-storage/)"
for path in $IN_STORAGE_BACKUP; do
if [ ! -e "/var/www/app/storage/$path" ]; then
cp -Rp "/var/www/app/docker-backup-storage/$path" "/var/www/app/storage/"
fi
done
# logging functions
in_log() {
local type="$1"; shift
printf '%s [%s] [Entrypoint]: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$type" "$*"
}
in_error() {
in_log ERROR "$@" >&2
exit 1
}
# Indirect expansion (ie) is not supported in bourne shell. That's why we are using this clunkiness here.
ie_gv() {
local line name value
set | \
while read line; do
name=${line%=*} value=${line#*=\'}
if [ "$name" = "$1" ]; then
echo ${value%\'}
fi
done
}
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "$(ie_gv ${var})" != "" ] && [ "$(ie_gv ${fileVar})" != "" ]; then
in_error "Both $var and $fileVar are set (but are exclusive)"
fi
local val="$def"
if [ "$(ie_gv ${var})" != "" ]; then
val=$(ie_gv ${var})
elif [ "$(ie_gv ${fileVar})" != "" ]; then
val=`cat $(ie_gv ${fileVar})`
fi
export "$var"="$val"
unset "$fileVar"
}
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
if [ ! -d /var/www/app/public/logo ]; then
cp -Rp /var/www/app/docker-backup-public/logo /var/www/app/public/logo
BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/
BAK_LOGO_PATH=/var/www/app/docker-backup-public/logo/
if [ ! -d /var/www/app/storage ]; then
cp -Rp $BAK_STORAGE_PATH /var/www/app/storage
else
IN_LOGO_BACKUP="$(ls /var/www/app/docker-backup-public/logo/)"
for path in $IN_LOGO_BACKUP; do
if [ ! -e "/var/www/app/public/logo/$path" ]; then
cp -Rp "/var/www/app/docker-backup-public/logo/$path" "/var/www/app/public/logo/"
fi
done
if [ -d $BAK_STORAGE_PATH ]; then
IN_STORAGE_BACKUP="$(ls $BAK_STORAGE_PATH)"
for path in $IN_STORAGE_BACKUP; do
if [ ! -e "/var/www/app/storage/$path" ]; then
cp -Rp "$BAK_STORAGE_PATH/$path" "/var/www/app/storage/"
fi
done
fi
fi
if [ ! -d /var/www/app/public/logo ] && [ -d $BAK_LOGO_PATH ]; then
cp -Rp $BAK_LOGO_PATH /var/www/app/public/logo
else
if [ -d $BAK_LOGO_PATH ]; then
IN_LOGO_BACKUP="$(ls $BAK_LOGO_PATH)"
for path in $IN_LOGO_BACKUP; do
if [ ! -e "/var/www/app/public/logo/$path" ]; then
cp -Rp "$BAK_LOGO_PATH/$path" "/var/www/app/public/logo/"
fi
done
fi
fi
# compare public volume version with image version
if [ ! -e /var/www/app/public/version ] || [ "$INVOICENINJA_VERSION" != "$(cat /var/www/app/public/version)" ]; then
echo 'clone public directory'
cp -Rp /var/www/app/docker-backup-public/* /var/www/app/public/
echo $INVOICENINJA_VERSION > /var/www/app/public/version
cp -au /var/www/app/docker-backup-public/* /var/www/app/public/
echo $INVOICENINJA_VERSION > /var/www/app/public/version
fi
#php artisan optimize --force
#php artisan migrate --force
# Set permission for mounted directories
chown invoiceninja:www-data /var/www/app/storage
chown invoiceninja:www-data /var/www/app/public
#if [ ! -e "/var/www/app/is-seeded" ]; then
#php artisan db:seed --force
#touch "/var/www/app/is-seeded"
#fi
# Initialize values that might be stored in a file
file_env 'APP_KEY'
file_env 'API_SECRET'
file_env 'CLOUDFLARE_API_KEY'
file_env 'DB_USERNAME'
file_env 'DB_PASSWORD'
file_env 'MAIL_USERNAME'
file_env 'MAIL_PASSWORD'
file_env 'MAILGUN_SECRET'
file_env 'S3_KEY'
file_env 'S3_SECRET'
echo 'start'
exec "$@"
# Run Laravel stuff
php artisan optimize
exec docker-php-entrypoint "$@"

View File

@@ -1,13 +0,0 @@
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

View File

@@ -1,43 +0,0 @@
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'

View File

@@ -1,50 +0,0 @@
user www-data;
events {
worker_connections 768;
}
http {
upstream backend {
server app:9000;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
gzip_disable "msie6";
server {
listen 80 default;
server_name your_ininja_site;
root /var/www/app/public;
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass backend;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
}
}