Skip to content

Commit

Permalink
Add database to devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
willsawyerrrr committed Aug 22, 2024
1 parent 2bcba2e commit 0a08551
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .devcontainer/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POSTGRES_DB="database"
POSTGRES_HOST="database"
POSTGRES_PASSWORD="password"
POSTGRES_USER="user"
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "Mortein Backend Application",
"image": "mcr.microsoft.com/devcontainers/dotnet:8.0",
"dockerComposeFile": "docker-compose.yaml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/backend",

"features": {
"ghcr.io/devcontainers/features/dotnet:2": {},
Expand All @@ -15,6 +17,7 @@
"extensions": [
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"ms-azuretools.vscode-docker",
"ms-dotnettools.csdevkit",
"redhat.vscode-yaml"
]
Expand Down
23 changes: 23 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.8"

services:
devcontainer:
command: sleep infinity
env_file: .env
image: mcr.microsoft.com/devcontainers/dotnet:8.0
networks:
- network
volumes:
- ..:/workspaces/backend:cached

database:
env_file: .env
image: postgres:latest
networks:
- network
ports:
- 5432:5432

networks:
network:
driver: bridge

0 comments on commit 0a08551

Please sign in to comment.