From a58b89c55dfe6e2258d2daaec4cba767761b0393 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 4 Jan 2021 20:11:50 +1100 Subject: [PATCH] Fixes for docker file" --- alpine/Dockerfile_v5 | 4 +-- docker-compose.yml | 67 ++++++++++++++++---------------------------- env | 9 ++++++ 3 files changed, 35 insertions(+), 45 deletions(-) create mode 100644 env diff --git a/alpine/Dockerfile_v5 b/alpine/Dockerfile_v5 index 2efbf74..0dd670b 100644 --- a/alpine/Dockerfile_v5 +++ b/alpine/Dockerfile_v5 @@ -85,8 +85,8 @@ RUN apk add --no-cache \ ## Separate user ENV INVOICENINJA_USER=invoiceninja -RUN addgroup -S "$INVOICENINJA_USER" && \ - adduser \ +RUN addgroup --gid=1500 -S "$INVOICENINJA_USER" && \ + adduser --uid=1500 \ --disabled-password \ --gecos "" \ --home "$(pwd)" \ diff --git a/docker-compose.yml b/docker-compose.yml index 31b3399..1fca194 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,55 +2,40 @@ version: '3.7' services: server: - image: caddy:alpine + image: nginx restart: always environment: - - APP_URL=https://localhost + - APP_URL=http://in.localhost:8003 volumes: # 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' # 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 + - ./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" + - "8003:80" + #- "443:443" networks: - invoiceninja app: image: invoiceninja/invoiceninja:5 + env_file: env restart: always cap_add: - SYS_ADMIN - environment: - - APP_URL=https://localhost - - APP_KEY= - - 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: - # 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 + - ./config/hosts:/etc/hosts:ro + - ./docker/app/public:/var/www/app/public:rw,delegated + - ./docker/app/storage:/var/www/app/storage:rw,delegated depends_on: - db networks: @@ -58,6 +43,8 @@ services: db: image: mysql:5 + ports: + - "3305:3306" restart: always environment: - MYSQL_ROOT_PASSWORD=ninjaAdm1nPassword @@ -65,24 +52,24 @@ services: - 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 + - ./docker/mysql/data:/var/lib/mysql:rw,delegated networks: - invoiceninja - # V5 crons only + # THIS IS ONLY A VALID CONFIGURATION FOR IN 5. DO NOT USE FOR IN 4. cron: image: invoiceninja/invoiceninja:5 + env_file: env volumes: - - public:/var/www/app/public - - storage:/var/www/app/storage + - ./config/hosts:/etc/hosts:ro + - ./docker/app/public:/var/www/app/public:rw,delegated + - ./docker/app/storage:/var/www/app/storage:rw,delegated entrypoint: | /bin/sh -c 'sh -s <> /dev/null 2>&1 + while true; do + php artisan schedule:run; sleep 60s done EOF' @@ -108,13 +95,7 @@ services: # EOF' # networks: # - invoiceninja - -volumes: - mysql-data: - public: - storage: - # This is needed for letting th cron run correctly - # logo: + # networks: - invoiceninja: + invoiceninja: \ No newline at end of file diff --git a/env b/env new file mode 100644 index 0000000..2cf0307 --- /dev/null +++ b/env @@ -0,0 +1,9 @@ +APP_URL=http://in.localhost:8003/ +APP_KEY= +APP_DEBUG=true +MULTI_DB_ENABLED=false +DB_HOST1=db +DB_USERNAME1=ninja +DB_PASSWORD1=ninja +DB_DATABASE1=ninja +PHANTOMJS_PDF_GENERATION=false \ No newline at end of file