Basic devcontainer setup
Getting xdebug working on osx is a pain, devcontainers are less pain...
This commit is contained in:
parent
fd1bb21f9d
commit
5897bfdb7b
3 changed files with 45 additions and 1 deletions
40
.devcontainer/devcontainer.json
Normal file
40
.devcontainer/devcontainer.json
Normal 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
1
.gitignore
vendored
|
@ -5,7 +5,6 @@ thumbs
|
|||
*.phar
|
||||
*.sqlite
|
||||
*.cache
|
||||
.devcontainer
|
||||
trace.json
|
||||
|
||||
#Composer
|
||||
|
|
|
@ -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
|
||||
FROM base AS composer
|
||||
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
|
||||
# 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 '=== 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
|
||||
FROM base
|
||||
EXPOSE 8000
|
||||
|
|
Reference in a new issue