From be223d144fe33486530bd5a6ee69ed9ab281b097 Mon Sep 17 00:00:00 2001 From: "Alex. Plokhikh" Date: Fri, 26 Apr 2024 17:46:35 +0500 Subject: [PATCH] STA-931|setup docker & nginx & db --- app/config/packages/doctrine.yaml | 4 +++- docker-compose.yml | 1 + docker/App.Dockerfile | 2 +- docker/App.Dockerfile.dockerignore | 5 +++++ docker/nginx/Dockerfile | 5 ----- docker/nginx/default.conf | 16 ---------------- docker/php/Dockerfile | 15 --------------- nginx/default.conf | 2 +- 8 files changed, 11 insertions(+), 39 deletions(-) delete mode 100644 docker/nginx/Dockerfile delete mode 100644 docker/nginx/default.conf delete mode 100644 docker/php/Dockerfile diff --git a/app/config/packages/doctrine.yaml b/app/config/packages/doctrine.yaml index 75ec9e8..bf5aa40 100644 --- a/app/config/packages/doctrine.yaml +++ b/app/config/packages/doctrine.yaml @@ -1,6 +1,8 @@ doctrine: dbal: - url: '%env(resolve:DATABASE_URL)%' + url: '%env(resolve:DB_URL)%' + user: '%env(resolve:DB_USER)%' + password: '%env(resolve:DB_PASSWORD)%' # IMPORTANT: You MUST configure your server version, # either here or in the DATABASE_URL env var (see .env file) diff --git a/docker-compose.yml b/docker-compose.yml index f4f1144..b0e0e0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: build: context: . dockerfile: docker/App.Dockerfile + container_name: ${APP_NAME}-app ports: - '9000:9000' volumes: diff --git a/docker/App.Dockerfile b/docker/App.Dockerfile index 76b3fbc..99a70ef 100644 --- a/docker/App.Dockerfile +++ b/docker/App.Dockerfile @@ -1,6 +1,6 @@ FROM php:fpm-alpine -WORKDIR app +WORKDIR var/www/project COPY app . diff --git a/docker/App.Dockerfile.dockerignore b/docker/App.Dockerfile.dockerignore index e69de29..468f164 100644 --- a/docker/App.Dockerfile.dockerignore +++ b/docker/App.Dockerfile.dockerignore @@ -0,0 +1,5 @@ +# --- ignore autogenerated composer files --- +/app/var/ +/app/vendor/ +/app/composer.lock +# ------------------------------------------- \ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile deleted file mode 100644 index a5bbf7c..0000000 --- a/docker/nginx/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM nginx:alpine - -COPY app app - -ADD docker/nginx/default.conf /etc/nginx/conf.d/ \ No newline at end of file diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf deleted file mode 100644 index 3df54dd..0000000 --- a/docker/nginx/default.conf +++ /dev/null @@ -1,16 +0,0 @@ -server { - index index.php; - error_log /var/log/nginx/error.log; - access_log /var/log/nginx/access.log; - root /app/public; - - location ~ \.php$ { - try_files $uri =404; - 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; - } -} diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile deleted file mode 100644 index 76b3fbc..0000000 --- a/docker/php/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM php:fpm-alpine - -WORKDIR app - -COPY app . - -RUN apk update && \ - apk add libpq-dev && \ - docker-php-ext-install pdo pdo_pgsql pgsql - -ENV COMPOSER_ALLOW_SUPERUSER=1 -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN composer install - -CMD ["php-fpm"] \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf index 4145474..3a58e90 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -7,7 +7,7 @@ server { try_files $uri /index.php$is_args$args; } location ~ ^/index\.php(/|$) { - fastcgi_pass php82-service:9000; + fastcgi_pass app:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; -- GitLab