diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e3ed7d1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..764e480 --- /dev/null +++ b/.env.example @@ -0,0 +1,66 @@ +#Laravel Backend +APP_NAME=Laravel +APP_ENV=local +APP_KEY= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=laravel +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +FILESYSTEM_DISK=local +QUEUE_CONNECTION=sync +SESSION_DRIVER=file +SESSION_LIFETIME=120 + +MEMCACHED_HOST=127.0.0.1 + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=mailpit +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_HOST= +PUSHER_PORT=443 +PUSHER_SCHEME=https +PUSHER_APP_CLUSTER=mt1 + +VITE_APP_NAME="${APP_NAME}" +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_HOST="${PUSHER_HOST}" +VITE_PUSHER_PORT="${PUSHER_PORT}" +VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" + +# Database +MYSQL_RANDOM_ROOT_PASSWORD=true +MYSQL_DATABASE=databse +MYSQL_USER=secret +MYSQL_PASSWORD=secret diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..870f442 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +frontend/.env +backend/.env diff --git a/backend/Dockerfile b/backend/Dockerfile index 33f6936..4f0e0ab 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -5,44 +5,35 @@ RUN mkdir -p /var/www/html/databasestore WORKDIR /var/www/html -# Install Composer manually COPY --from=composer/composer:latest-bin /composer /usr/bin/composer -RUN apk add --no-cache \ - npm - COPY ./ /var/www/html RUN composer install --optimize-autoloader --no-interaction --no-dev --ignore-platform-req=ext-intl -FROM unit:php8.2 +FROM dunglas/frankenphp RUN mkdir -p /var/www/html -RUN mkdir -p /var/www/html/databasestore +RUN mkdir -p /app/public/databasestore -WORKDIR /var/www/html +WORKDIR /app/public -COPY --from=build --chown=unit:unit /var/www/html /var/www/html +COPY --from=build /var/www/html /app/public ENV TZ=Europe/Berlin -# Update package lists and install required dependencies -RUN apt-get update && apt-get install -y \ - libicu-dev \ - libjpeg-dev \ - libpng-dev \ - libfreetype6-dev \ - sudo \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Install and enable the intl and gd extensions -RUN docker-php-ext-install intl gd - -COPY docker/config.json /docker-entrypoint.d/config.json +RUN apt-get update && \ + apt-get install -y netcat-traditional && \ + rm -rf /var/lib/apt/lists/* -COPY docker/entrypoint.sh /docker-entrypoint.d/entrypoint.sh +RUN install-php-extensions \ + pdo_mysql \ + gd \ + intl \ + zip \ + opcache -RUN chmod +x /docker-entrypoint.d/entrypoint.sh +RUN chmod +x /app/public/docker/entrypoint.sh -EXPOSE 80 +ENTRYPOINT ["/app/public/docker/entrypoint.sh"] +CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ] diff --git a/backend/docker/config.json b/backend/docker/config.json deleted file mode 100644 index 219e17b..0000000 --- a/backend/docker/config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "listeners": { - "*:80": { - "pass": "routes" - } - }, - "routes": [ - { - "match": { - "uri": "!/index.php" - }, - "action": { - "share": "/var/www/html/public$uri", - "response_headers": { - "Cache-Control": "max-age=60, s-maxage=120" - }, - "fallback": { - "pass": "applications/laravel" - } - } - } - ], - "applications": { - "laravel": { - "type": "php", - "root": "/var/www/html/public/", - "script": "index.php" - } - } -} diff --git a/docker-compose.yml b/docker-compose.yml index c12fac9..732167f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,23 @@ services: options: max-size: "10m" + database: + image: mysql:8.0 + volumes: + - mysql:/var/lib/mysql:cached + networks: + - stack + ports: + - 127.0.0.1:3306:3306 + env_file: + - .env + command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --sql_mode='' + logging: + options: + max-size: "10m" + max-file: "3" + restart: always + frontend: image: ghcr.io/chaostreff-flensburg/pretty-good-proposal/frontend:latest restart: always