mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-06 14:37:26 +01:00
Compare commits
277 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a184cf2844 | ||
|
|
94e8be57e5 | ||
|
|
385a434833 | ||
|
|
9ddeda4c32 | ||
|
|
805e526fc9 | ||
|
|
cdc35aff2f | ||
|
|
1de16ab390 | ||
|
|
b9ab50800d | ||
|
|
d2d03b9b18 | ||
|
|
ea0f3fa981 | ||
|
|
1d9a8681b2 | ||
|
|
f98b3915bd | ||
|
|
8762276c6f | ||
|
|
afcd9389ed | ||
|
|
591c799864 | ||
|
|
4c9c5ddd95 | ||
|
|
994d75a07e | ||
|
|
3348a2beb6 | ||
|
|
c30cae4a99 | ||
|
|
1ed95cdcec | ||
|
|
94126385e2 | ||
|
|
e64dd79cfc | ||
|
|
5942c1c362 | ||
|
|
78b5e59cd5 | ||
|
|
d1a8922f7d | ||
|
|
d87e5948bf | ||
|
|
f4cade9fac | ||
|
|
49f4266418 | ||
|
|
e7f6ef4c35 | ||
|
|
1af469cf04 | ||
|
|
2d934fd703 | ||
|
|
a7668325e8 | ||
|
|
7aef08794b | ||
|
|
001c922e45 | ||
|
|
85161446e9 | ||
|
|
14c0fd89eb | ||
|
|
7b08926961 | ||
|
|
a5e41d3072 | ||
|
|
72e07679eb | ||
|
|
6d65f5e114 | ||
|
|
61cef26f80 | ||
|
|
e2d6cbd853 | ||
|
|
21cc3ddf2c | ||
|
|
8245a57117 | ||
|
|
6b25f47ba1 | ||
|
|
1168dec11b | ||
|
|
f81e0c8f11 | ||
|
|
3e2d5a4f8c | ||
|
|
42e2c2234e | ||
|
|
4e05229fed | ||
|
|
c5fb1ab64b | ||
|
|
b190c8e633 | ||
|
|
4350619c64 | ||
|
|
a38b398d5d | ||
|
|
3f8fb906b5 | ||
|
|
8962e0d0b9 | ||
|
|
fc6923ad40 | ||
|
|
3b907d6093 | ||
|
|
431f11ccd4 | ||
|
|
2de45a45ab | ||
|
|
6037ebf2c2 | ||
|
|
685801983a | ||
|
|
f1a5f6fc7b | ||
|
|
6cbdec0686 | ||
|
|
4c855161f6 | ||
|
|
1447268f94 | ||
|
|
c0c13705ae | ||
|
|
11869a23a1 | ||
|
|
39bc2f0d89 | ||
|
|
0ff6e56ed8 | ||
|
|
ac5f1bfad5 | ||
|
|
fb064cb05e | ||
|
|
a84ec51b3f | ||
|
|
e2cafb8b72 | ||
|
|
672fc41611 | ||
|
|
eeffc2191c | ||
|
|
8a6622bbbb | ||
|
|
4f3f7ca8fe | ||
|
|
9e8db1b5bd | ||
|
|
6bcfd57208 | ||
|
|
db9e0f4309 | ||
|
|
cb91ba9973 | ||
|
|
9060027999 | ||
|
|
26c91935fc | ||
|
|
7c5275e766 | ||
|
|
482b30b677 | ||
|
|
7a45036c72 | ||
|
|
a963db2b63 | ||
|
|
26a71f7f1f | ||
|
|
af98f696b9 | ||
|
|
696d3b356a | ||
|
|
0ef00831f6 | ||
|
|
6ba1f11221 | ||
|
|
933748e15b | ||
|
|
03180fc65e | ||
|
|
e0fcb50ecb | ||
|
|
5c418c474e | ||
|
|
5e59ec10e3 | ||
|
|
6b0182e712 | ||
|
|
961282a90e | ||
|
|
3a17d81cab | ||
|
|
a3bb9b9681 | ||
|
|
766b604971 | ||
|
|
005e1b9dfe | ||
|
|
8d0a39ac71 | ||
|
|
6e12296f25 | ||
|
|
dbac9305c9 | ||
|
|
3c96683d46 | ||
|
|
279a282d44 | ||
|
|
e0332086d4 | ||
|
|
63ffa18860 | ||
|
|
960c3172e9 | ||
|
|
43ff450c2d | ||
|
|
aaa6118286 | ||
|
|
1ab7bc02d6 | ||
|
|
9625d9d9d0 | ||
|
|
3bd5324136 | ||
|
|
e28c8dc07b | ||
|
|
4ab4039887 | ||
|
|
650851811a | ||
|
|
72762dc964 | ||
|
|
dc66ca0544 | ||
|
|
52992d622b | ||
|
|
9dcf825f85 | ||
|
|
350a9fad35 | ||
|
|
d8ca192f8e | ||
|
|
b6d213682d | ||
|
|
0d88a6268f | ||
|
|
c641680309 | ||
|
|
47116c7d78 | ||
|
|
41544ec1e0 | ||
|
|
f3b5a62d36 | ||
|
|
69d2f54b03 | ||
|
|
5a1c1c16d7 | ||
|
|
3ade74efc9 | ||
|
|
dc00f6a604 | ||
|
|
3ef75b29ff | ||
|
|
e6df981f06 | ||
|
|
27bdb5d95b | ||
|
|
206fe5db2d | ||
|
|
4e5022fcc4 | ||
|
|
ded7e32051 | ||
|
|
d2ae9b365b | ||
|
|
612645fad2 | ||
|
|
192f6d7648 | ||
|
|
083fe9648e | ||
|
|
6ad5e6ec48 | ||
|
|
13487557e6 | ||
|
|
16f77b069e | ||
|
|
58c4eb66d4 | ||
|
|
d044303647 | ||
|
|
09b5b84750 | ||
|
|
2932f92f4c | ||
|
|
3ad282ac29 | ||
|
|
507451d7ca | ||
|
|
2d563e4b73 | ||
|
|
991b22e121 | ||
|
|
c4e8f3ea0b | ||
|
|
ee272cd52f | ||
|
|
a60567ae16 | ||
|
|
d81542e536 | ||
|
|
19333d150a | ||
|
|
ad1c976a31 | ||
|
|
bd7153a0b7 | ||
|
|
c1fde99ad4 | ||
|
|
c7d901f8c3 | ||
|
|
e432564e48 | ||
|
|
2d42e33da0 | ||
|
|
00ae03ce24 | ||
|
|
5f4e58ba77 | ||
|
|
b822d9d53a | ||
|
|
8a935f042e | ||
|
|
ddb96915cf | ||
|
|
c90e0dd42b | ||
|
|
5d2760a47a | ||
|
|
e0f46d2034 | ||
|
|
ce4cf2118b | ||
|
|
17759c3df7 | ||
|
|
c97fd64020 | ||
|
|
467960061b | ||
|
|
2dfa7e1edd | ||
|
|
475b3e7121 | ||
|
|
7c40a5a813 | ||
|
|
b92c8d928e | ||
|
|
0ed2a1cf4c | ||
|
|
43bb842598 | ||
|
|
8c1c2488bd | ||
|
|
baf2459f72 | ||
|
|
89ad8ad2bf | ||
|
|
d80a0fa212 | ||
|
|
bce728b558 | ||
|
|
23a8241d13 | ||
|
|
302da0c895 | ||
|
|
81075f2595 | ||
|
|
fae767223f | ||
|
|
a896a49e48 | ||
|
|
4d00017b2a | ||
|
|
9601557224 | ||
|
|
5b1bb1f277 | ||
|
|
2208768dfe | ||
|
|
5690f782b8 | ||
|
|
61cd833979 | ||
|
|
546ee0b139 | ||
|
|
cde6e6ecd1 | ||
|
|
c07242eb1c | ||
|
|
c27b04b63a | ||
|
|
540d3180f1 | ||
|
|
f3811ef09b | ||
|
|
0f114b8827 | ||
|
|
bbc3e5303b | ||
|
|
554233c9ea | ||
|
|
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 | ||
|
|
c1ffc73205 | ||
|
|
951fc81b3e | ||
|
|
63aff31222 | ||
|
|
af26a7e26c | ||
|
|
16c6e0b80b | ||
|
|
4da0796c49 | ||
|
|
28ff00d785 | ||
|
|
0ca7f61b17 | ||
|
|
d0f7f6e2f8 | ||
|
|
35067a0fd8 |
24
.editorconfig
Normal file
24
.editorconfig
Normal 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
26
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal 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 ?
|
||||||
35
.github/workflows/build_push.yml
vendored
Normal file
35
.github/workflows/build_push.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
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: Logout from DockerHub
|
||||||
|
run: docker logout
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
data
|
|
||||||
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at contact@invoiceninja.com. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
61
Dockerfile
61
Dockerfile
@@ -1,61 +0,0 @@
|
|||||||
FROM php:fpm
|
|
||||||
|
|
||||||
MAINTAINER Samuel Laulhau <sam@lalop.co>
|
|
||||||
|
|
||||||
#####
|
|
||||||
# SYSTEM REQUIREMENT
|
|
||||||
#####
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y \
|
|
||||||
libmcrypt-dev zlib1g-dev git \
|
|
||||||
libfreetype6-dev libjpeg62-turbo-dev libpng12-dev\
|
|
||||||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
|
||||||
&& docker-php-ext-install iconv mcrypt mbstring pdo pdo_mysql zip gd \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
#####
|
|
||||||
# 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 2.5.1.2
|
|
||||||
#ENV INVOICENINJA_SHA1 3e9b63c1681b6923dc1a24399411c1abde6ef5ea
|
|
||||||
|
|
||||||
RUN curl -o invoiceninja.tar.gz -SL https://github.com/hillelcoren/invoice-ninja/archive/v${INVOICENINJA_VERSION}.tar.gz \
|
|
||||||
# && echo "$INVOICENINJA_SHA1 *invoiceninja.tar.gz" | sha1sum -c - \
|
|
||||||
&& 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 --prefer-source\
|
|
||||||
&& mv /var/www/app/storage /var/www/app/docker-backup-storage \
|
|
||||||
&& mv /var/www/app/public/logo /var/www/app/docker-backup-public-logo
|
|
||||||
|
|
||||||
|
|
||||||
######
|
|
||||||
# DEFAULT ENV
|
|
||||||
######
|
|
||||||
ENV DB_HOST mysql
|
|
||||||
ENV DB_DATABASE ninja
|
|
||||||
ENV APP_KEY SomeRandomString
|
|
||||||
ENV LOG errorlog
|
|
||||||
ENV APP_DEBUG 0
|
|
||||||
|
|
||||||
|
|
||||||
#use to be mounted into nginx for exemple
|
|
||||||
VOLUME /var/www/app/public
|
|
||||||
|
|
||||||
WORKDIR /var/www/app
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
COPY app-entrypoint.sh /entrypoint.sh
|
|
||||||
RUN chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
CMD ["php-fpm"]
|
|
||||||
58
Makefile
Normal file
58
Makefile
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
# Version of Invoice Ninja. As the tag can be something like 5.0.4-p1, the version is 5.0.4.
|
||||||
|
# This supports changes to the Dockerfiles with always the same Invoice Ninja version
|
||||||
|
VERSION=$(shell echo ${TAG} | sed "s/-.*//")
|
||||||
|
|
||||||
|
# Building docker images based on alpine.
|
||||||
|
# Assigned tags:
|
||||||
|
# - :alpine
|
||||||
|
# - :alpine-<RELEASE VERSION>
|
||||||
|
.PHONY: build-alpine
|
||||||
|
build-alpine:
|
||||||
|
ifeq ($(IS_V5),)
|
||||||
|
$(info Make: Building "$(VERSION)" tagged images from alpine.)
|
||||||
|
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} --file ./alpine/Dockerfile .
|
||||||
|
# Tag as alpine-4
|
||||||
|
@docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} ${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-${VERSION}
|
||||||
|
@docker push ${HUB_NAMESPACE}/${IMAGE}:alpine-4
|
||||||
|
$(info Make: Done.)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: build-alpine-v5
|
||||||
|
build-alpine-v5:
|
||||||
|
ifneq ($(IS_V5),)
|
||||||
|
$(info Make: Building "$(VERSION)" tagged images from alpine.)
|
||||||
|
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} --file ./alpine/Dockerfile_v5 .
|
||||||
|
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:5
|
||||||
|
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${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}:${VERSION}
|
||||||
|
@docker push ${HUB_NAMESPACE}/${IMAGE}:5
|
||||||
|
@docker push ${HUB_NAMESPACE}/${IMAGE}:latest
|
||||||
|
endif
|
||||||
39
README.md
39
README.md
@@ -1,29 +1,20 @@
|
|||||||
DockerFile for invoice ninja (https://www.invoiceninja.com/)
|

|
||||||
|
[](https://hub.docker.com/r/invoiceninja/invoiceninja)
|
||||||
|
[](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 try this image is via docker compose :
|
: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.
|
||||||
|
|
||||||
```
|
:crown: **Features**
|
||||||
db:
|
|
||||||
image: mysql
|
|
||||||
environment:
|
|
||||||
MYSQL_DATABASE: ninja
|
|
||||||
MYSQL_ROOT_PASSWORD: mdp
|
|
||||||
|
|
||||||
app:
|
:lock: Automatic HTTPS (:heart: [Caddy](https://caddyserver.com/))
|
||||||
image: invoiceninja/invoiceninja
|
:hammer: Fully production-ready through docker-compose
|
||||||
links:
|
:pencil: Adjustable to your needs via environment variable
|
||||||
- db:mysql
|
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Please see our [wiki](https://github.com/invoiceninja/dockerfiles/wiki) for further guidance.
|
||||||
|
|
||||||
web:
|
|
||||||
image: nginx
|
|
||||||
volumes:
|
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
||||||
links:
|
|
||||||
- app
|
|
||||||
volumes_from:
|
|
||||||
- app
|
|
||||||
ports:
|
|
||||||
- 80
|
|
||||||
```
|
|
||||||
|
|||||||
78
alpine/Dockerfile
Normal file
78
alpine/Dockerfile
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
ARG PHP_VERSION=7.2
|
||||||
|
|
||||||
|
FROM php:${PHP_VERSION}-fpm-alpine
|
||||||
|
|
||||||
|
LABEL maintainer="Samuel Laulhau <sam@lalop.co>, Holger Lösken <holger.loesken@codedge.de>"
|
||||||
|
|
||||||
|
#####
|
||||||
|
# SYSTEM REQUIREMENT
|
||||||
|
#####
|
||||||
|
ARG INVOICENINJA_VERSION
|
||||||
|
WORKDIR /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 \
|
||||||
|
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"]
|
||||||
125
alpine/Dockerfile_v5
Normal file
125
alpine/Dockerfile_v5
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
ARG PHP_VERSION=7.3
|
||||||
|
|
||||||
|
# Get Invoice Ninja
|
||||||
|
FROM alpine:latest as base
|
||||||
|
ARG INVOICENINJA_VERSION
|
||||||
|
|
||||||
|
RUN set -eux; \
|
||||||
|
apk add --no-cache \
|
||||||
|
curl \
|
||||||
|
mysql-client \
|
||||||
|
git \
|
||||||
|
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 \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
mysql-client \
|
||||||
|
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
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
chromium \
|
||||||
|
nss \
|
||||||
|
freetype \
|
||||||
|
freetype-dev \
|
||||||
|
harfbuzz \
|
||||||
|
ca-certificates \
|
||||||
|
ttf-freefont \
|
||||||
|
nodejs \
|
||||||
|
yarn
|
||||||
|
|
||||||
|
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
|
||||||
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
||||||
|
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
|
|
||||||
|
# Puppeteer v1.19.0 works with Chromium 77.
|
||||||
|
RUN yarn add puppeteer@1.19.0
|
||||||
|
|
||||||
|
## 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;
|
||||||
|
|
||||||
|
## Set up the cronjob and run cron daemon
|
||||||
|
RUN echo "* * * * * run-parts /etc/periodic/1min" >> /etc/crontabs/root
|
||||||
|
COPY ./config/cron/cronjob_v5.sh /etc/periodic/1min/invoiceninja_cronjob
|
||||||
|
RUN chown $INVOICENINJA_USER /etc/periodic/1min/invoiceninja_cronjob && \
|
||||||
|
crond -l 2 -b
|
||||||
|
|
||||||
|
USER $INVOICENINJA_USER
|
||||||
|
|
||||||
|
RUN composer install --no-dev --no-suggest --no-progress --quiet
|
||||||
|
|
||||||
|
# Override the environment settings from projects .env file
|
||||||
|
ENV APP_ENV production
|
||||||
|
ENV LOG errorlog
|
||||||
|
|
||||||
|
RUN php artisan storage:link
|
||||||
|
|
||||||
|
ENTRYPOINT ["docker-entrypoint"]
|
||||||
|
CMD ["php-fpm"]
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#!/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
|
|
||||||
mv /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
|
|
||||||
mv "/var/www/app/docker-backup-storage/$path" "/var/www/app/storage/"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d /var/www/app/public/logo ]; then
|
|
||||||
mv /var/www/app/docker-backup-public-logo /var/www/app/public/logo
|
|
||||||
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
|
|
||||||
mv "/var/www/app/docker-backup-public-logo/$path" "/var/www/app/public/logo/"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
chown www-data .env
|
|
||||||
|
|
||||||
exec "$@"
|
|
||||||
6
config/caddy/Caddyfile
Normal file
6
config/caddy/Caddyfile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{$APP_URL} {
|
||||||
|
root * /var/www/app/public
|
||||||
|
php_fastcgi app:9000
|
||||||
|
encode zstd gzip
|
||||||
|
file_server browse
|
||||||
|
}
|
||||||
3
config/cron/cronjob_v5.sh
Executable file
3
config/cron/cronjob_v5.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cd /var/www/app; php artisan schedule:run >> /dev/null 2>&1
|
||||||
25
config/nginx/in-vhost.conf
Normal file
25
config/nginx/in-vhost.conf
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name in.localhost;
|
||||||
|
|
||||||
|
root /var/www/app/public/;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
18
config/php/php-cli.ini
Normal file
18
config/php/php-cli.ini
Normal 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
17
config/php/php.ini
Normal 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
|
||||||
99
docker-compose.yml
Normal file
99
docker-compose.yml
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
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
|
||||||
|
cap_add:
|
||||||
|
- SYS_ADMIN
|
||||||
|
environment:
|
||||||
|
- APP_URL=https://localhost
|
||||||
|
- APP_KEY=<INSERT THE GENERATED APPLICATION KEY HERE>
|
||||||
|
- MULTI_DB_ENABLED=false
|
||||||
|
- DB_HOST1=db
|
||||||
|
- DB_USERNAME1=ninja
|
||||||
|
- DB_PASSWORD1=ninja
|
||||||
|
- DB_DATABASE1=ninja
|
||||||
|
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=ninja
|
||||||
|
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
|
||||||
|
|
||||||
|
# THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
|
||||||
|
# cron:
|
||||||
|
# image: invoiceninja/invoiceninja:alpine-4
|
||||||
|
# volumes:
|
||||||
|
# - storage:/var/www/app/storage
|
||||||
|
# - logo:/var/www/app/public/logo
|
||||||
|
# - public:/var/www/app/public
|
||||||
|
# entrypoint: |
|
||||||
|
# /bin/sh -c 'sh -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:
|
||||||
|
# This is needed for letting th cron run correctly
|
||||||
|
# logo:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
invoiceninja:
|
||||||
108
entrypoint.sh
Executable file
108
entrypoint.sh
Executable file
@@ -0,0 +1,108 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 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 "magic" here.
|
||||||
|
ie_gv() {
|
||||||
|
eval "echo \$$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
cp -au /var/www/app/docker-backup-public/* /var/www/app/public/
|
||||||
|
echo $INVOICENINJA_VERSION > /var/www/app/public/version
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set permission for web server to create/update files
|
||||||
|
chown -R invoiceninja:www-data /var/www/app/storage /var/www/app/public /var/www/app/bootstrap
|
||||||
|
|
||||||
|
# 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_USERNAME1'
|
||||||
|
file_env 'DB_USERNAME2'
|
||||||
|
file_env 'DB_PASSWORD'
|
||||||
|
file_env 'DB_PASSWORD1'
|
||||||
|
file_env 'DB_PASSWORD2'
|
||||||
|
file_env 'MAIL_USERNAME'
|
||||||
|
file_env 'MAIL_PASSWORD'
|
||||||
|
file_env 'MAILGUN_SECRET'
|
||||||
|
file_env 'S3_KEY'
|
||||||
|
file_env 'S3_SECRET'
|
||||||
|
|
||||||
|
# Run Laravel stuff
|
||||||
|
php artisan config:cache
|
||||||
|
php artisan optimize
|
||||||
|
|
||||||
|
exec docker-php-entrypoint "$@"
|
||||||
50
nginx.conf
50
nginx.conf
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user