diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/.gitignore b/app/.gitignore index a1ade6761c96fb2d13315a5ae2e30355bf81e82d..50be080239c928ba6a19dcccee86d6394b1463a7 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -8,6 +8,7 @@ /public/bundles/ /var/ /vendor/ +composer.lock ###< symfony/framework-bundle ### ###> phpunit/phpunit ### diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..f4f11445ebd91c6c694463d790a618345119438e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,46 @@ +version: '3.1' + +services: + db: + image: postgres:16.2 + container_name: ${APP_NAME}-db + environment: + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_USER: ${DB_USER} + POSTGRES_DB: ${DB_NAME} + networks: + - app + ports: + - '5432:5432' + + nginx: + image: nginx:stable-alpine + container_name: ${APP_NAME}-nginx + ports: + - '80:80' + volumes: + - ./app:/var/www/project + - ./nginx/default.conf:/etc/nginx/conf.d/default.conf + networks: + - app + links: + - app + depends_on: + - app + + app: + build: + context: . + dockerfile: docker/App.Dockerfile + ports: + - '9000:9000' + volumes: + - ./app:/var/www/project + networks: + - app + depends_on: + - db + +networks: + app: + driver: bridge \ No newline at end of file diff --git a/docker/App.Dockerfile b/docker/App.Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..76b3fbcc75929a6a1f9a924aeb7abfcd5511fbde --- /dev/null +++ b/docker/App.Dockerfile @@ -0,0 +1,15 @@ +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/docker/App.Dockerfile.dockerignore b/docker/App.Dockerfile.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000000000000000000000000000000000000..4145474062f6128ffb538d6176171015049aeb31 --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,25 @@ +server { + listen 80; + index index.php; + server_name localhost; + root /var/www/project/public; + location / { + try_files $uri /index.php$is_args$args; + } +location ~ ^/index\.php(/|$) { + fastcgi_pass php82-service:9000; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + fastcgi_buffer_size 128k; + fastcgi_buffers 4 256k; + fastcgi_busy_buffers_size 256k; + internal; + } +location ~ \.php$ { + return 404; + } +error_log /var/log/nginx/project_error.log; + access_log /var/log/nginx/project_access.log; +} \ No newline at end of file