Fixes for docker file"

This commit is contained in:
David Bomba
2021-01-04 20:11:50 +11:00
parent a82d60b4f5
commit a58b89c55d
3 changed files with 35 additions and 45 deletions

View File

@@ -85,8 +85,8 @@ RUN apk add --no-cache \
## Separate user ## Separate user
ENV INVOICENINJA_USER=invoiceninja ENV INVOICENINJA_USER=invoiceninja
RUN addgroup -S "$INVOICENINJA_USER" && \ RUN addgroup --gid=1500 -S "$INVOICENINJA_USER" && \
adduser \ adduser --uid=1500 \
--disabled-password \ --disabled-password \
--gecos "" \ --gecos "" \
--home "$(pwd)" \ --home "$(pwd)" \

View File

@@ -2,55 +2,40 @@ version: '3.7'
services: services:
server: server:
image: caddy:alpine image: nginx
restart: always restart: always
environment: environment:
- APP_URL=https://localhost - APP_URL=http://in.localhost:8003
volumes: volumes:
# Vhost configuration # Vhost configuration
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile #- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
- ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
# Configure your mounted directories, make sure the folder 'public' and 'storage' # Configure your mounted directories, make sure the folder 'public' and 'storage'
# exist, before mounting them # 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! # 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/public:/var/www/app/public:rw,delegated
# - ./docker/app/storage:/var/www/app/storage:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on: depends_on:
- app - app
# Run webserver nginx on port 80 # Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied # Feel free to modify depending what port is already occupied
ports: ports:
- "80:80" - "8003:80"
- "443:443" #- "443:443"
networks: networks:
- invoiceninja - invoiceninja
app: app:
image: invoiceninja/invoiceninja:5 image: invoiceninja/invoiceninja:5
env_file: env
restart: always restart: always
cap_add: cap_add:
- SYS_ADMIN - 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
- PHANTOMJS_PDF_GENERATION=false
- SNAPPDF_EXECUTABLE_PATH="/usr/bin/chromium-browser"
- SNAPPDF_SKIP_DOWNLOAD=true
volumes: 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! # 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 - ./config/hosts:/etc/hosts:ro
# - ./docker/app/storage:/var/www/app/storage:rw,delegated - ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated
depends_on: depends_on:
- db - db
networks: networks:
@@ -58,6 +43,8 @@ services:
db: db:
image: mysql:5 image: mysql:5
ports:
- "3305:3306"
restart: always restart: always
environment: environment:
- MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword - MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword
@@ -65,24 +52,24 @@ services:
- MYSQL_PASSWORD=ninja - MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=ninja - MYSQL_DATABASE=ninja
volumes: 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! # 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 - ./docker/mysql/data:/var/lib/mysql:rw,delegated
networks: networks:
- invoiceninja - invoiceninja
# V5 crons only # THIS IS ONLY A VALID CONFIGURATION FOR IN 5. DO NOT USE FOR IN 4.
cron: cron:
image: invoiceninja/invoiceninja:5 image: invoiceninja/invoiceninja:5
env_file: env
volumes: volumes:
- public:/var/www/app/public - ./config/hosts:/etc/hosts:ro
- storage:/var/www/app/storage - ./docker/app/public:/var/www/app/public:rw,delegated
- ./docker/app/storage:/var/www/app/storage:rw,delegated
entrypoint: | entrypoint: |
/bin/sh -c 'sh -s <<EOF /bin/sh -c 'sh -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM trap "break;exit" SIGHUP SIGINT SIGTERM
sleep 60s while true; do
while /bin/true; do php artisan schedule:run;
./artisan schedule:run >> /dev/null 2>&1
sleep 60s sleep 60s
done done
EOF' EOF'
@@ -108,13 +95,7 @@ services:
# EOF' # EOF'
# networks: # networks:
# - invoiceninja # - invoiceninja
#
volumes:
mysql-data:
public:
storage:
# This is needed for letting th cron run correctly
# logo:
networks: networks:
invoiceninja: invoiceninja:

9
env Normal file
View File

@@ -0,0 +1,9 @@
APP_URL=http://in.localhost:8003/
APP_KEY=<insert your generated key in here>
APP_DEBUG=true
MULTI_DB_ENABLED=false
DB_HOST1=db
DB_USERNAME1=ninja
DB_PASSWORD1=ninja
DB_DATABASE1=ninja
PHANTOMJS_PDF_GENERATION=false