From b613ab9cc6d95e8066c1e152afd8746a47221b21 Mon Sep 17 00:00:00 2001 From: Bogdan Vizureanu Date: Sat, 26 Feb 2022 13:51:37 +0200 Subject: [PATCH 1/2] add multicontainer build add nonsecure http locally --- Dockerfile | 9 ++++++--- configs/nginx.app.local.conf | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 configs/nginx.app.local.conf diff --git a/Dockerfile b/Dockerfile index dabe153..56c9702 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,10 @@ -FROM php:7.3-fpm-alpine +FROM composer:latest as packages +WORKDIR /app +COPY ${PWD}/src /app/ +RUN composer install --ignore-platform-reqs --no-scripts --no-interaction --prefer-dist --optimize-autoloader +FROM php:7.3-fpm-alpine as runtime WORKDIR /var/www - +COPY --from=packages --chown=www-data:www-data /app/ /var/www/ RUN chown -R www-data:www-data /var/www - CMD ["php-fpm"] \ No newline at end of file diff --git a/configs/nginx.app.local.conf b/configs/nginx.app.local.conf new file mode 100644 index 0000000..ef3046f --- /dev/null +++ b/configs/nginx.app.local.conf @@ -0,0 +1,20 @@ +server { + index index.php index.html; + root /var/www/public; + + location / { + try_files $uri /index.php?$args; + } + + 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_param PATH_INFO $fastcgi_path_info; + fastcgi_param APP_DEBUG true; + } + + listen 80; +} From 89dcb3050ae85d08bef0e11fc12426d76bd774eb Mon Sep 17 00:00:00 2001 From: Bogdan Vizureanu Date: Sat, 26 Feb 2022 13:55:25 +0200 Subject: [PATCH 2/2] [wip] attempt to separate compose files --- docker-compose.deploy.yml | 18 ++++++++++++++++++ docker-compose.override.yml | 16 ++++++++++++++++ docker-compose.yml | 17 ++++++++--------- 3 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 docker-compose.deploy.yml create mode 100644 docker-compose.override.yml diff --git a/docker-compose.deploy.yml b/docker-compose.deploy.yml new file mode 100644 index 0000000..4b9bdee --- /dev/null +++ b/docker-compose.deploy.yml @@ -0,0 +1,18 @@ +version: '3' +services: + # The Application + app: + env_file: ./src/.env + + # The Web Server + web: + volumes: + - ./configs/nginx.app.conf:/etc/nginx/conf.d/default.conf + - /etc/letsencrypt/:/etc/letsencrypt/ + ports: + - 443:443 + # The Database + databases: + env_file: ./src/.env +volumes: + dbdata: diff --git a/docker-compose.override.yml b/docker-compose.override.yml new file mode 100644 index 0000000..4f557a3 --- /dev/null +++ b/docker-compose.override.yml @@ -0,0 +1,16 @@ +version: '3' +services: + # The Application + app: + env_file: ./src/.env.example + + # The Web Server + web: + volumes: + - ./configs/nginx.app.local.conf:/etc/nginx/conf.d/default.conf + ports: + - 80:80 + + # The Database + database: + env_file: ./src/.env.example diff --git a/docker-compose.yml b/docker-compose.yml index e0cabcd..a70ba32 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,9 @@ services: context: ./ dockerfile: Dockerfile working_dir: /var/www - volumes: - - ./src:/var/www - env_file: ./src/.env + # volumes: + # - ./src:/var/www + #env_file: ./src/.env environment: - "DB_PORT=5984" - "DB_HOST=database" @@ -18,23 +18,22 @@ services: # The Web Server web: image: nginx:1.15 - working_dir: /var/www + #working_dir: /var/www volumes: - - ./src:/var/www + #- ./src:/var/www - ./configs/nginx.app.conf:/etc/nginx/conf.d/default.conf - - /etc/letsencrypt/:/etc/letsencrypt/ + #- /etc/letsencrypt/:/etc/letsencrypt/ ports: - 80:80 - - 443:443 # The Database database: image: couchdb:latest volumes: - dbdata:/opt/couchdb/data - ./configs/couch.local.ini:/opt/couchdb/etc/local.ini - env_file: ./src/.env + # env_file: ./src/.env ports: - "5984:5984" volumes: - dbdata: + dbdata: \ No newline at end of file