Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "IPAG SDK PHP Development",
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],
"service": "lcslucas-ipag-sdk",
"workspaceFolder": "/var/www/html",
"shutdownAction": "stopCompose",

// Forward ports for debugging
"forwardPorts": [9000, 9003],
"portsAttributes": {
"9003": {
"label": "Xdebug",
"onAutoForward": "silent"
},
"9000": {
"label": "PHP-FPM",
"onAutoForward": "silent"
}
},

"postCreateCommand": "composer install",

"customizations": {
"vscode": {
"extensions": [
"xdebug.php-debug",
"bmewburn.vscode-intelephense-client",
"DEVSENSE.phptools-vscode",
"neilbrayfield.php-docblocker",
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-portuguese-brazilian",
"formulahendry.code-runner",
"shardulm94.trailing-spaces",
"MehediDracula.php-namespace-resolver",
"yzhang.markdown-all-in-one",
"junstyle.php-cs-fixer",
"GitHub.copilot-chat",
"GitHub.copilot",
"ms-azuretools.vscode-docker"
],
"settings": {
"php.validate.executablePath": "/usr/local/bin/php",
"php.debug.executablePath": "/usr/local/bin/php",
"intelephense.files.maxSize": 5000000,
"files.watcherExclude": {
"**/vendor/**": true,
"**/node_modules/**": true
}
}
}
},

"remoteUser": "root"
}
13 changes: 13 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
lcslucas-ipag-sdk:
volumes:
- ..:/var/www/html:cached

# Configurações para Xdebug no Dev Container
environment:
- PHP_IDE_CONFIG=serverName=devcontainer
- XDEBUG_CONFIG=client_host=localhost

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"
33 changes: 33 additions & 0 deletions .docker/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[PHP]
; Configurações para desenvolvimento
display_errors = On
display_startup_errors = On
error_reporting = E_ALL
log_errors = On
error_log = /var/log/php_errors.log

; Memory limit
memory_limit = 256M

; Execution time
max_execution_time = 120

; Upload
upload_max_filesize = 20M
post_max_size = 20M

; Timezone
date.timezone = "America/Sao_Paulo"

[Xdebug]
; Xdebug 3 configuration for Dev Container
xdebug.mode = debug,develop
xdebug.start_with_request = yes
xdebug.client_host = localhost
xdebug.client_port = 9003
xdebug.idekey = VSCODE
xdebug.log = /var/log/xdebug.log
xdebug.log_level = 0

; Coverage (opcional, para testes)
; xdebug.mode = coverage
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
composer.phar
/vendor/
*.Identifier
.devcontainer
.vscode
Dockerfile
annotations.md
.phpunit.cache
clover.xml
69 changes: 69 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
###############################################################################
# Imagem PHP + Apache
# Referência: https://gist.github.com/avandrevitor/bc9b28cba063468eda7bbeee9b485114
#
FROM php:7.4-fpm-alpine as builder

ENV COMPOSER_ALLOW_SUPERUSER=1

WORKDIR /var/www/html/

# Atualizar repositórios Alpine
RUN apk update

# Install Dependencies - Usando apk para Alpine
RUN apk add --no-cache \
bash \
curl \
bzip2 \
libzip-dev \
bzip2-dev \
libxml2-dev \
git \
tar \
unzip \
zip \
icu-dev \
autoconf \
gcc \
g++ \
make \
linux-headers \
$PHPIZE_DEPS

# Extensões
RUN docker-php-ext-install bcmath
RUN docker-php-ext-install calendar
RUN docker-php-ext-install zip
RUN docker-php-ext-install intl

# Configurar e instalar OPcache
RUN docker-php-ext-configure opcache && \
docker-php-ext-install opcache

# Instalar Xdebug (versão compatível com PHP 7.4)
RUN pecl channel-update pecl.php.net && \
pecl install xdebug-3.1.6 && \
docker-php-ext-enable xdebug

# Configurar Xdebug (configuração básica, será sobrescrita pelo php.ini)
RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.log=/var/log/xdebug.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
echo "xdebug.idekey=VSCODE" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

# Composer#Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Copiar configurações personalizadas do PHP
COPY .docker/php.ini /usr/local/etc/php/conf.d/99-custom.ini

# RUN bash -c "composer install"

FROM builder

WORKDIR /var/www/html/

RUN find . -type f | xargs -I{} chmod -v 644 {} && \
find . -type d | xargs -I{} chmod -v 755 {};
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
lcslucas-ipag-sdk:
container_name: lcslucas-ipag-sdk
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
working_dir: /var/www/html
volumes:
- ./:/var/www/html
ports:
- "9000:9000" # PHP-FPM
- "9003:9003" # Xdebug
environment:
- PHP_IDE_CONFIG=serverName=docker
- XDEBUG_CONFIG=remote_host=host.docker.internal
Loading