diff --git a/.env b/.env deleted file mode 100644 index a7ae4fc87cf5577082b274e938f4aa123fba1919..0000000000000000000000000000000000000000 --- a/.env +++ /dev/null @@ -1,41 +0,0 @@ -# In all environments, the following files are loaded if they exist, -# the latter taking precedence over the former: -# -# * .env contains default values for the environment variables needed by the app -# * .env.local uncommitted file with local overrides -# * .env.$APP_ENV committed environment-specific defaults -# * .env.$APP_ENV.local uncommitted environment-specific overrides -# -# Real environment variables win over .env files. -# -# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. -# https://symfony.com/doc/current/configuration/secrets.html -# -# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). -# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration - -###> symfony/framework-bundle ### -APP_ENV=dev -APP_SECRET=ea3ebbf899855d483050e0d1aad6a759 -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -# -# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" -# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" -DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" -###< doctrine/doctrine-bundle ### - -###> symfony/messenger ### -# Choose one of the transports below -# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages -# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages -MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 -###< symfony/messenger ### - -###> symfony/mailer ### -# MAILER_DSN=null://null -###< symfony/mailer ### diff --git a/.env.test b/.env.test deleted file mode 100644 index 9e7162f0b01d8778e236e79f4121e0926f68c194..0000000000000000000000000000000000000000 --- a/.env.test +++ /dev/null @@ -1,6 +0,0 @@ -# define your env variables for the test env here -KERNEL_CLASS='App\Kernel' -APP_SECRET='$ecretf0rt3st' -SYMFONY_DEPRECATIONS_HELPER=999999 -PANTHER_APP_ENV=panther -PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots diff --git a/.gitignore b/.gitignore index 930e1e21e27cc2916f9dd36aa9e577d0fb0b2ee0..f8810d3065e89d017a7d3c35e8e08313e20373b0 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ /public/assets/ /assets/vendor/ ###< symfony/asset-mapper ### -/.idea \ No newline at end of file +/.idea +.env +.env.test \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a4e3a367852e61ae9b4f34336abbc4e71bb98bdb --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,41 @@ +version: "3" + +services: + database: + container_name: postgres + image: postgres:16.2-alpine + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - "${DATABASE_PORT}:5432" + networks: + - internal + nginx: + build: + dockerfile: ./docker/nginx/Dockerfile + args: + COMPOSER_AUTH: "{}" + APP_BASE_DIR: ${APP_BASE_DIR-.} + volumes: + - ".:/app" + ports: + - '${NGINX_PORT}:80' + networks: + - internal + app: + build: + dockerfile: ./docker/php/Dockerfile + args: + COMPOSER_AUTH: "{}" + APP_BASE_DIR: ${APP_BASE_DIR-.} + volumes: + - ".:/app" + restart: unless-stopped + networks: + - internal + +networks: + internal: + driver: bridge \ No newline at end of file diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..085ae3610df58345dd192d04e4d51f729e066d80 --- /dev/null +++ b/docker/nginx/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:alpine + +WORKDIR "/app" + +ARG APP_BASE_DIR +COPY $APP_BASE_DIR . +RUN cp docker/nginx/default.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf new file mode 100644 index 0000000000000000000000000000000000000000..e28298757e4f8eb99f9ef3af08c7890d078b4368 --- /dev/null +++ b/docker/nginx/default.conf @@ -0,0 +1,31 @@ +server { + #This config is based on https://github.com/daylerees/laravel-website-configs/blob/6db24701073dbe34d2d58fea3a3c6b3c0cd5685b/nginx.conf + + # The location of our project's public directory. + root /app/public; + + # Point index to the Laravel front controller. + index index.php; + + location / { + # URLs to attempt, including pretty ones. + try_files $uri $uri/ /index.php?$query_string; + } + + # Remove trailing slash to please routing system. + if (!-d $request_filename) { + rewrite ^/(.+)/$ /$1 permanent; + } + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini + # # With php5-fpm: + 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; + } +} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/php/Dockerfile similarity index 61% rename from docker/Dockerfile rename to docker/php/Dockerfile index 2fca0d57ca4b965197eb6b15ee191aeceb45c286..e4b730f1c9275824bf78bbdc5913d51dbb6ec43b 100644 --- a/docker/Dockerfile +++ b/docker/php/Dockerfile @@ -2,11 +2,13 @@ FROM php:fpm-alpine WORKDIR "/app" -COPY .. . +ARG APP_BASE_DIR +COPY $APP_BASE_DIR . + +RUN apk update && \ + apk add libpq-dev && \ + docker-php-ext-install pdo pdo_pgsql pgsql -RUN set -ex \ - && apk --no-cache add \ - postgresql-dev RUN docker-php-ext-install pdo pdo_pgsql @@ -16,4 +18,6 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local RUN composer install +RUN chmod -R 777 /app/var + CMD ["php-fpm"]