Skip to content

Commit

Permalink
Add Docker configuration for development environment with MongoDB sup…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
abaldeweg authored Jan 30, 2025
1 parent 0ea9460 commit 3a60a89
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 22 deletions.
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mcr.microsoft.com/devcontainers/go:1-1.23-bookworm
44 changes: 22 additions & 22 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/abaldeweg/devcontainer_features/bash:2.0.0": {}
},
"forwardPorts": [
5984
],
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"golang.go",
"DavidAnson.vscode-markdownlint",
"redhat.vscode-yaml",
"42Crunch.vscode-openapi",
"alexcvzz.vscode-sqlite"
]
}
},
"postCreateCommand": "sudo apt update && sudo apt install -y sqlite3"
"name": "Go",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/abaldeweg/devcontainer_features/bash:2.0.0": {}
},
"forwardPorts": [
5984
],
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig",
"golang.go",
"DavidAnson.vscode-markdownlint",
"redhat.vscode-yaml",
"42Crunch.vscode-openapi",
"mongodb.mongodb-vscode"
]
}
}
}
20 changes: 20 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.8'

services:
app:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../..:/workspaces:cached
command: sleep infinity
network_mode: service:db

db:
image: mongo:latest
restart: unless-stopped
volumes:
- mongodb-data:/data/db

volumes:
mongodb-data:

0 comments on commit 3a60a89

Please sign in to comment.