From d9d5a15376816dc920289ef0860536b79851a58b Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Mon, 24 Jul 2023 20:54:30 -0400 Subject: [PATCH] Docker --- .env.sample | 3 +++ Dockerfile | 2 ++ docker-compose.yml | 25 ++++++++++++++----------- nginx.conf | 7 ++----- 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 .env.sample diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..ea98faf --- /dev/null +++ b/.env.sample @@ -0,0 +1,3 @@ +COMPOSE_PROFILES=app,db +APP_PATH=./app +APP_PORT=8080 diff --git a/Dockerfile b/Dockerfile index 509141c..2b3b2ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,8 @@ RUN docker-php-ext-install pdo pdo_mysql zip intl gd bcmath RUN pecl install xdebug-3.1.3 \ && docker-php-ext-enable xdebug +COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini + COPY --from=composer /usr/bin/composer /usr/bin/composer WORKDIR /code diff --git a/docker-compose.yml b/docker-compose.yml index 4052376..58ae7bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,10 +11,11 @@ services: container_name: incoviba_web <<: *restart ports: - - "8080:80" + - "${APP_PORT}:80" volumes: - - .:/code + - ${APP_PATH:-.}/:/code - ./nginx.conf:/etc/nginx/conf.d/default.conf + - ./logs/proxy:/logs php: profiles: @@ -23,13 +24,12 @@ services: container_name: incoviba_php <<: *restart env_file: - - .env - - .db.env - - .remote.env + - ${APP_PATH:-.}/.env + - ${APP_PATH:-.}/.db.env + #- ${APP_PATH:-.}/.remote.env volumes: - - .:/code - - ./php-errors.ini:/usr/local/etc/php/conf.d/docker-php-errors.ini - - ./logs:/logs + - ${APP_PATH:-.}/:/code + - ./logs/php:/logs db: profiles: @@ -37,9 +37,10 @@ services: image: mariadb:latest container_name: incoviba_db <<: *restart - env_file: .db.env + env_file: ${APP_PATH:-.}/.db.env volumes: - dbdata:/var/lib/mysql + - ./incoviba.sql.gz:/docker-entrypoint-initdb.d/incoviba.sql.gz networks: - default - adminer_network @@ -50,9 +51,11 @@ services: image: adminer:latest container_name: incoviba_adminer <<: *restart + env_file: ${APP_PATH:-.}/.adminer.env + networks: + - adminer_network ports: - "8083:8080" - env_file: .adminer.env python: profiles: @@ -80,7 +83,7 @@ services: - "8084:80" volumes: - dbdata: + dbdata: {} networks: adminer_network: {} diff --git a/nginx.conf b/nginx.conf index 42bb089..dfbee25 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,13 +2,10 @@ server { listen 80; server_name web; index index.php; - error_log /code/logs/error.log; - access_log /code/logs/access.log; + error_log /logs/error.log; + access_log /logs/access.log; root /code/public; - location /api { - try_files $uri /api/index.php$is_args$args; - } location / { try_files $uri /index.php$is_args$args; }