Skip to content

Commit

Permalink
Recover devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
moreal committed Oct 24, 2024
1 parent f5ae164 commit 621ff7e
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/bin/postAttachCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

dotnet restore
8 changes: 8 additions & 0 deletions .devcontainer/bin/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -ev

sudo apt update -qq
sudo apt install -qq -y vim

git config core.editor "vim"
54 changes: 29 additions & 25 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
"name": "Mimir & Mimir.Worker",
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
],
"service": "devcontainer",
"workspaceFolder": "/workspace",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/mongodb-atlas-cli-homebrew:1": {},
"ghcr.io/devcontainers-contrib/features/mongosh-homebrew:1": {}
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/github-cli:1": {}
},

// 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": [5195, 7272],
"forwardPorts": [7272, 27017],
"portsAttributes": {
"7272": {
"label": "MongoDB",
"protocol": "https"
}
},
"27017": {
"label": "MongoDB"
}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postAttachCommand": "./.devcontainer/scripts/postCreateCommand.sh"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"postCreateCommand": "./.devcontainer/bin/postCreateCommand.sh",
"postAttachCommand": "./.devcontainer/bin/postAttachCommand.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.vscode-dotnet-runtime",
"ms-dotnettools.csharp",
"ms-dotnettools.csdevkit",
"mongodb.mongodb-vscode"
]
}
}
}
7 changes: 7 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
devcontainer:
image: mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm
volumes:
- .:/workspace
network_mode: service:mongo
command: sleep infinity
4 changes: 0 additions & 4 deletions .devcontainer/scripts/postCreateCommand.sh

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,5 @@ obj/
Generated

appsettings.local.json

!.devcontainer/bin
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
mongo:
image: mongo:latest
restart: unless-stopped
ports:
- "27017:27017"

0 comments on commit 621ff7e

Please sign in to comment.