diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 0000000..851435b --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,28 @@ +FROM php:8.2 + +COPY --from=composer:2.6.5 /usr/bin/composer /usr/bin/composer + +RUN apt-get update \ + && apt-get install -y \ + git \ + # Install node + && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install --no-install-recommends -y nodejs \ + && node --version \ + && npm --version + +# Install PHP extensions +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN chmod uga+x /usr/local/bin/install-php-extensions && sync \ + && install-php-extensions \ + xdebug \ + zip \ + @composer \ + && rm /usr/local/bin/install-php-extensions + +RUN echo "alias jigsaw=./vendor/bin/jigsaw" >> ~/.bashrc && \ + echo "alias compile='./vendor/bin/jigsaw build'" >> ~/.bashrc && \ + /bin/bash -c "source ~/.bashrc" + +COPY entrypoint.sh /var/www/scripts/ +ENTRYPOINT [ "bash", "/var/www/scripts/entrypoint.sh" ] diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh new file mode 100644 index 0000000..25beaf9 --- /dev/null +++ b/.docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Set uid of host machine +usermod --non-unique --uid "${HOST_UID}" www-data +groupmod --non-unique --gid "${HOST_GID}" www-data + +php /var/www/html/vendor/bin/jigsaw serve --host=0.0.0.0 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..276c64a --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +HTTP_PORT=80 + +HOST_UID=1000 +HOST_GID=1000 + +TZ=America/Sao_Paulo + +XDEBUG_CONFIG="client_host=172.17.0.1 client_port=9003 start_with_request=yes" diff --git a/config.php b/config.php index 5aa1813..d9d0aa1 100644 --- a/config.php +++ b/config.php @@ -3,7 +3,7 @@ return [ 'production' => false, 'baseUrl' => '', - 'title' => 'Jigsaw', - 'description' => 'Website description.', + 'title' => 'PHP Rio', + 'description' => 'Site do grupo de usuário de PHP do Rio de Janeiro.', 'collections' => [], ]; diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9508e71 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + + backend: + build: .docker + ports: + - "127.0.0.1:${HTTP_PORT:-8000}:8000" + volumes: + - .:/var/www/html + environment: + - HOST_UID=${HOST_UID:-1000} + - HOST_GID=${HOST_GID:-1000} + - TZ=${TZ:-America/Sao_Paulo} + - XDEBUG_CONFIG=${XDEBUG_CONFIG:-"client_host=172.17.0.1 client_port=9003 start_with_request=yes"}