Skip to content

Commit

Permalink
chore: support devcontainer development (#220)
Browse files Browse the repository at this point in the history
We add a devcontainer and Dockerfile to do local develpoment in
IntelliJ. We also add a Makefile wtih the common dev targets.
  • Loading branch information
malandis authored Oct 16, 2024
1 parent 759c9e4 commit d0c9a85
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mcr.microsoft.com/devcontainers/php:8.1-bookworm

RUN pecl install grpc protobuf && docker-php-ext-enable grpc protobuf
33 changes: 33 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/php
{
"name": "PHP",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"dockerFile": "Dockerfile",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
},

// Configure tool-specific properties.

"customizations" : {
"jetbrains" : {
"backend" : "IntelliJ",
"plugins": ["com.jetbrains.php"],
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8080],

"containerEnv": {
"MOMENTO_API_KEY": "${localEnv:MOMENTO_API_KEY}"
},

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html"

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.PHONY: install lint-check lint test

install:
@echo "Installing dependencies..."
@composer install

lint-check:
@echo "Checking code style..."
@php vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none

lint:
@echo "Fixing code style..."
@php vendor/bin/php-cs-fixer fix --diff --show-progress=none

test:
@echo "Running tests..."
@php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml

0 comments on commit d0c9a85

Please sign in to comment.