diff --git a/.env.example b/.env.example index 33ab962..83dd32e 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,9 @@ SERVER_NAME=trial -POSTGRES_USER=trail_user +POSTGRES_USER=trial_user POSTGRES_PASSWORD=trial_password POSTGRES_DB=trial_db PGPORT=5433 TLS_MODE=tls_selfsigned TLS_AUTO_EMAIL=jhon.doe@example.com +APP_ENV=prod +APP_SECRET=eb09be4fcc136ed9174c7136f13b98e4 \ No newline at end of file diff --git a/README.md b/README.md index d02715e..a623dbd 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,13 @@ your desire please make sure you changed them in both places. To access the test you will need to write the server name in your `/etc/hosts` file. E.g. ``` -~ #> echo "trial 127.0.0.1" >> /etc/hosts +~ #> echo "127.0.0.1 trial" >> /etc/hosts ``` Run `docker compose up -d` -Run `docker compose exec --workdir=/var/www/trial php /usr/local/bin/composer install` +Run `docker compose exec --workdir=/var/www/trial php /usr/local/bin/php ./bin/console cache:clear` +Run `docker compose exec --workdir=/var/www/trial php /usr/local/bin/php ./bin/console doctrine:migrations:migrate --no-interaction` +Run `docker compose exec --workdir=/var/www/trial php /usr/bin/yarn encore prod` To access the test then just simply visit `https://trial:8443` (you need to agree with self-signed cert). diff --git a/app/.env b/app/.env index fb65d1f..5855111 100644 --- a/app/.env +++ b/app/.env @@ -1,5 +1,5 @@ -APP_ENV=dev -APP_SECRET=eb09be4fcc136ed9174c7136f13b98e4 +APP_ENV="%env(APP_ENV)%" +APP_SECRET="%env(APP_SECRET)%" -DATABASE_URL="postgresql://trial_user:trial_password@postgres:5433/trial_db?serverVersion=16&charset=utf8" +DATABASE_URL="postgresql://%env(POSTGRES_USER)%:%env(POSTGRES_PASSWORD)%@postgres:%env(PGPORT)%/%env(POSTGRES_DB)%?serverVersion=16&charset=utf8" diff --git a/app/composer.json b/app/composer.json index bcd40ea..133982e 100644 --- a/app/composer.json +++ b/app/composer.json @@ -53,16 +53,9 @@ "symfony/polyfill-php81": "*" }, "scripts": { - "auto-scripts": { - "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" - }, - "post-install-cmd": [ - "@auto-scripts" - ], - "post-update-cmd": [ - "@auto-scripts" - ] + "auto-scripts": {}, + "post-install-cmd": [], + "post-update-cmd": [] }, "conflict": { "symfony/symfony": "*" diff --git a/docker/fpm/Dockerfile b/docker/fpm/Dockerfile index 11bf9c3..618fe37 100644 --- a/docker/fpm/Dockerfile +++ b/docker/fpm/Dockerfile @@ -1,12 +1,23 @@ FROM php:8.2-fpm + RUN apt-get update && apt-get install -y \ libpq-dev \ libzip-dev \ unzip \ libonig-dev \ - libxml2-dev && \ + libxml2-dev \ + curl gpg && \ docker-php-ext-install -j$(nproc) pdo pdo_pgsql zip mbstring pcntl +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash ;\ + apt-get update; \ + apt-get install -y nodejs + RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ -&& php -r "unlink('composer-setup.php');" \ No newline at end of file +&& php -r "unlink('composer-setup.php');" + +WORKDIR /var/www/trial +COPY ./app/composer.json ./app/composer.lock ./app/package.json ./app/yarn.lock ./app/symfony.lock ./ + +RUN composer install && npm install -g yarn -y && yarn install \ No newline at end of file