Skip to content

Commit

Permalink
Add vscode dev container configuration
Browse files Browse the repository at this point in the history
This enables us to run vscode inside a container[1]
Running it inside a container allows the db and softhsm tests to run
Debugging tests (with breakpoints) in vscode should also be possible when running it inside a container!

[1] https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
  • Loading branch information
hneiva committed Jul 30, 2024
1 parent e1c63de commit 63d0b0c
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// NOTE: YOU MUST RUN docker compose build app && docker compose build BEFORE ATTEMPTING TO RUN DEV CONTAINERS

// 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": "Root Dockerfile"
,"dockerComposeFile": "docker-compose.yml"
,"service": "app-hsm"
,"containerUser": "app"
// ,"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind"
,"workspaceFolder": "/workspace"

// Features to add to the dev container. More info: https://containers.dev/features.
,"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "1.22",
"golangciLintVersion": "1.59.1"
},
"ghcr.io/devcontainers/features/git:1": {}
}
// Ensure the container is alive and running
,"overrideCommand": true

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
,"remoteUser": "root"
}
40 changes: 40 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
volumes:
apptmpdir:
hsmtmpdir:
services:
db:
extends:
service: db
file: ../docker-compose.yml
app:
extends:
service: app
file: ../docker-compose.yml
volumes:
- apptmpdir:/tmp/
- ../:/workspace
app-hsm:
extends:
service: app-hsm
file: ../docker-compose.yml
volumes:
- hsmtmpdir:/tmp/
- ../:/workspace
# We don't really need these for dev work
# but will keep these commented out just in case
# monitor:
# extends:
# service: monitor
# file: ../docker-compose.yml
# monitor-lambda-emulator:
# extends:
# service: monitor-lambda-emulator
# file: ../docker-compose.yml
# monitor-hsm-lambda-emulator:
# extends:
# service: monitor-hsm-lambda-emulator
# file: ../docker-compose.yml
# unit-test:
# extends:
# service: unit-test
# file: ../docker-compose.yml

0 comments on commit 63d0b0c

Please sign in to comment.