Skip to content

Commit c87f805

Browse files
committed
feat: add devcontainer spec
1 parent 3518092 commit c87f805

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu
2+
3+
# Install Elixir and Erlang from Ubuntu repositories
4+
RUN apt-get update && \
5+
apt-get install -y erlang elixir && \
6+
apt-get clean && \
7+
rm -rf /var/lib/apt/lists/*
8+
9+
# Install Docker CLI
10+
RUN apt-get update && \
11+
apt-get install -y --no-install-recommends \
12+
docker.io && \
13+
apt-get clean && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
# Add user vscode to docker group
17+
RUN usermod -aG docker vscode
18+
19+
# Install Rust for vscode user
20+
USER vscode
21+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
22+
ENV PATH="/home/vscode/.cargo/bin:${PATH}"
23+
24+
# Install cross for cross compilation
25+
RUN cargo install cross
26+
27+
# Switch back to root for any additional setup
28+
USER root

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "Rust and Elixir Development",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "dev",
5+
"workspaceFolder": "/workspace",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"rust-lang.rust-analyzer",
10+
"jakebecker.elixir-ls",
11+
"ms-azuretools.vscode-docker"
12+
]
13+
}
14+
},
15+
"remoteUser": "vscode",
16+
"remoteEnv": {
17+
"PATH": "${containerEnv:PATH}:/home/vscode/.cargo/bin"
18+
},
19+
"mounts": [
20+
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
21+
"source=${localEnv:HOME}/.ssh,target=${localEnv:HOME}/.ssh,type=bind,consistency=cached",
22+
"source=${localEnv:HOME}/.gitconfig.d,target=/home/vscode/.gitconfig.d,type=bind,consistency=cached"
23+
],
24+
"updateContentCommand": "[ -d ~/.cargo ] || curl https://sh.rustup.rs -sSf | sh -s -- -y"
25+
}

.devcontainer/docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3.8'
2+
3+
services:
4+
dev:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
volumes:
9+
- ..:/workspace:cached
10+
command: sleep infinity
11+
network_mode: service:docker
12+
13+
docker:
14+
image: docker:dind
15+
privileged: true
16+
command: ["--host=tcp://0.0.0.0:2375"]
17+
ports:
18+
- "2375:2375"

0 commit comments

Comments
 (0)