Skip to content

Commit 4c38132

Browse files
MuraskoKitt3120
andcommitted
Add Devcontainer (#40)
* added devcontainer added postgresql and some nice to have extensions * removed clang to fix pipelines * Update .devcontainer/devcontainer.json Co-authored-by: Torben Schweren <torben@schweren.dev> * Update .devcontainer/docker-compose.yml Co-authored-by: Torben Schweren <torben@schweren.dev> --------- Co-authored-by: Torben Schweren <torben@schweren.dev>
1 parent 60547b9 commit 4c38132

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed

.devcontainer/.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
POSTGRES_USER=postgres
2+
POSTGRES_PASSWORD=postgres
3+
POSTGRES_DB=postgres
4+
POSTGRES_HOSTNAME=localhost
5+
POSTGRES_PORT=5432

.devcontainer/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM mcr.microsoft.com/devcontainers/rust:1-1-bullseye
2+
3+
# Include lld linker to improve build times either by using environment variable
4+
# RUSTFLAGS="-C link-arg=-fuse-ld=lld" or with Cargo's configuration file (i.e see .cargo/config.toml).
5+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6+
&& apt-get autoremove -y && apt-get clean -y

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "lum",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6+
7+
// Comment out the extensions you do not want to install
8+
"customizations":{
9+
"vscode": {
10+
"extensions": [
11+
"github.copilot-chat",
12+
"github.copilot",
13+
"JScearcy.rust-doc-viewer",
14+
"swellaby.vscode-rust-test-adapter",
15+
"Gruntfuggly.todo-tree",
16+
"usernamehw.errorlens"
17+
]
18+
}
19+
},
20+
21+
"remoteUser": "vscode"
22+
}

.devcontainer/docker-compose.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.8'
2+
3+
volumes:
4+
postgres-data:
5+
6+
services:
7+
app:
8+
build:
9+
context: .
10+
dockerfile: Dockerfile
11+
env_file:
12+
# Ensure that the variables in .env match the same variables in devcontainer.json
13+
- .env
14+
15+
volumes:
16+
- ../..:/workspaces:cached
17+
18+
# Overrides default command so things don't shut down after the process ends.
19+
command: sleep infinity
20+
21+
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
22+
network_mode: service:db
23+
24+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
25+
# (Adding the "ports" property to this file will not forward from a Codespace.)
26+
27+
db:
28+
image: postgres
29+
restart: unless-stopped
30+
volumes:
31+
- postgres-data:/var/lib/postgresql/data
32+
env_file:
33+
# Ensure that the variables in .env match the same variables in devcontainer.json
34+
- .env
35+
36+
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
37+
# (Adding the "ports" property to this file will not forward from a Codespace.)

0 commit comments

Comments
 (0)