Basic devcontainer setup

Getting xdebug working on osx is a pain, devcontainers are less pain...
This commit is contained in:
Shish 2023-12-13 23:51:51 +00:00 committed by Shish
parent fd1bb21f9d
commit 5897bfdb7b
3 changed files with 45 additions and 1 deletions

View file

@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Shimmie Dockerfile",
"build": {
"context": "..",
"dockerfile": "../Dockerfile",
"target": "devcontainer"
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "apt update && apt install -y composer php8.2-xdebug git",
"customizations": {
"vscode": {
"extensions": [
"recca0120.vscode-phpunit",
"ryanluker.vscode-coverage-gutters"
],
"settings": {
"phpunit.args": [
"--configuration", "${workspaceFolder}/tests/phpunit.xml"//,
//"--coverage-clover", "data/coverage.clover"
],
"coverage-gutters.coverageFileNames": [
"data/coverage.clover"
]
}
}
}
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}

1
.gitignore vendored
View file

@ -5,7 +5,6 @@ thumbs
*.phar *.phar
*.sqlite *.sqlite
*.cache *.cache
.devcontainer
trace.json trace.json
#Composer #Composer

View file

@ -11,6 +11,7 @@ RUN apt update && apt upgrade -y && apt install -y \
# Composer has 100MB of dependencies, and we only need that during build and test # Composer has 100MB of dependencies, and we only need that during build and test
FROM base AS composer FROM base AS composer
RUN apt update && apt upgrade -y && apt install -y composer php${PHP_VERSION}-xdebug && rm -rf /var/lib/apt/lists/* RUN apt update && apt upgrade -y && apt install -y composer php${PHP_VERSION}-xdebug && rm -rf /var/lib/apt/lists/*
ENV XDEBUG_MODE=coverage
# "Build" shimmie (composer install - done in its own stage so that we don't # "Build" shimmie (composer install - done in its own stage so that we don't
# need to include all the composer fluff in the final image) # need to include all the composer fluff in the final image)
@ -36,6 +37,10 @@ RUN [ $RUN_TESTS = false ] || (\
echo '=== Coverage ===' && XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-text && \ echo '=== Coverage ===' && XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-text && \
echo '=== Cleaning ===' && rm -rf data) echo '=== Cleaning ===' && rm -rf data)
# Devcontainer target
FROM composer AS devcontainer
RUN apt update && apt upgrade -y && apt install -y git && rm -rf /var/lib/apt/lists/*
# Actually run shimmie # Actually run shimmie
FROM base FROM base
EXPOSE 8000 EXPOSE 8000