Skip to content

Commit

Permalink
Merge pull request #9 from PHPRio/feature/docker
Browse files Browse the repository at this point in the history
Ambiente básico de desenvolvimento no Docker
  • Loading branch information
giovannism20 authored Nov 28, 2023
2 parents b8e2e64 + c2b80d5 commit 2f6169d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
28 changes: 28 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
7 changes: 7 additions & 0 deletions .docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [],
];
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"}

0 comments on commit 2f6169d

Please sign in to comment.