Skip to content

Commit

Permalink
devcontainers
Browse files Browse the repository at this point in the history
  • Loading branch information
scottt732 committed Nov 3, 2023
1 parent ac22bff commit 3eec303
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '3.8'
services:
devcontainer:
image: mcr.microsoft.com/devcontainers/dotnet:7.0-bookworm
volumes:
- ../:/workspaces/Sholo.Mqtt:cached
network_mode: service:mosquitto
command: sleep infinity

mosquitto:
image: eclipse-mosquitto:latest
container_name: mosquitto
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ./config:/mosquitto/config:rw
- mosquitto-data:/mosquitto/data:rw
- mosquitto-log:/mosquitto/log:rw
restart: unless-stopped

volumes:
mosquitto-data:
mosquitto-log:
7 changes: 7 additions & 0 deletions .devcontainer/config/mosquitto.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
allow_anonymous true
listener 1883
listener 9001
protocol websockets
persistence true
persistence_file mosquitto.db
persistence_location /mosquitto/data/
53 changes: 53 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "Sholo.Mqtt",
"dockerComposeFile": "compose.yaml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/Sholo.Mqtt",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
"configureZshAsDefaultShell": true,
"installOhMyZsh": true,
"installOhMyZshConfig": true,
"upgradePackages": true
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/act:1": {},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/apt-get-packages:1": {
"packages": "curl,nano,bat,direnv,htop"
}
},
"containerEnv": {
"DOTNET_ENVIRONMENT": "Development"
},
"remoteEnv": {
},
"customizations": {
"codespaces": {
"repositories": {
"scottt732/Sholo.Mqtt": {
"permissions": "write-all"
}
}
},
"vscode": {
"settings": {
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true
},
"extensions": [
"codezombiech.gitignore",
"michelemelluso.gitignore",
"eamodio.gitlens",
"GitHub.copilot",
"ms-dotnettools.csdevkit",
"formulahendry.dotnet-test-explorer"
]
}
},
"postCreateCommand": "dotnet restore",
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}"
}
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Sample (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Samples/Mqtt.Sample/bin/Debug/net7.0/Mqtt.Sample.dll",
"args": [],
"cwd": "${workspaceFolder}/Samples/Mqtt.Sample",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Attach",
"type": "coreclr",
"request": "attach"
}
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Sholo.Mqtt.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Sholo.Mqtt.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Sholo.Mqtt.sln"
],
"problemMatcher": "$msCompile"
}
]
}
3 changes: 1 addition & 2 deletions Samples/Mqtt.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ await Host.CreateDefaultBuilder(args)
.ConfigureMqttHost(app => { app.UseRouting(); })
.UseConsoleLifetime(opt => { opt.SuppressStatusMessages = true; })
.Build()
.RunAsync()
;
.RunAsync();
}
}
2 changes: 1 addition & 1 deletion Samples/Mqtt.Sample/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"mqtt": {
"host": "mqtt.artiql.local",
"host": "mosquitto",
"port": 1883
}
}
5 changes: 3 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"sdk": {
"rollForward": "latestMajor",
"version": "5.0.101"
"version": "7.0.403",
"rollForward": "latestMinor",
"allowPrerelease": false
}
}

0 comments on commit 3eec303

Please sign in to comment.