Restructure docker-compose

* Use alpine images
* Remove separate directory
* Give more hints in docker-compose file
This commit is contained in:
Holger Lösken
2020-05-12 14:57:25 +02:00
committed by Samuel Laulhau
parent e2cafb8b72
commit a84ec51b3f
5 changed files with 108 additions and 89 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

84
docker-compose.yml Normal file
View File

@@ -0,0 +1,84 @@
version: '3.6'
services:
nginx:
image: nginx:alpine
restart: always
volumes:
# Vhost configuration
- ./config/nginx/default.conf:/etc/nginx/conf.d/default.conf
# 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"
networks:
- invoiceninja
app:
image: invoiceninja/invoiceninja:alpine
restart: always
environment:
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
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
env_file: .env
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:

View File

@@ -1,17 +0,0 @@
MYSQL_DATABASE=ninja
MYSQL_ROOT_PASSWORD=pwd
APP_DEBUG=0
APP_URL=http://localhost:8000
APP_KEY=SomeRandomStringSomeRandomString
APP_CIPHER=AES-256-CBC
DB_USERNAME=root
DB_PASSWORD=pwd
DB_HOST=db
DB_DATABASE=ninja
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,72 +0,0 @@
version: '3.6'
volumes:
db:
storage:
logo:
public:
# uncomment if you want to use external network (example network: "web")
#networks:
# web:
# external: true
services:
db:
image: mysql:5
env_file: .env
restart: always
volumes:
- db:/var/lib/mysql
networks:
- default
app:
image: invoiceninja/invoiceninja
env_file: .env
restart: always
depends_on:
- db
volumes:
- storage:/var/www/app/storage
- logo:/var/www/app/public/logo
- public:/var/www/app/public
networks:
- default
web:
image: nginx:1
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- storage:/var/www/app/storage
- logo:/var/www/app/public/logo
- public:/var/www/app/public
expose: # Expose ports without publishing them to the host machine - theyll only be accessible to linked services.
- "80"
depends_on:
- app
ports: # Delete if you want to use reverse proxy
- 8000:80
networks:
# - web # uncomment if you want to use external network (reverse proxy for example)
- default
cron:
image: invoiceninja/invoiceninja
env_file: .env
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:
- default