Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM mcr.microsoft.com/devcontainers/base:bookworm

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile default --component rustfmt,clippy \
&& echo 'source $HOME/.cargo/env' >> $HOME/.bashrc

# Install Node.js LTS
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install Bun
RUN curl -fsSL https://bun.sh/install | bash \
&& echo 'export BUN_INSTALL="$HOME/.bun"' >> $HOME/.bashrc \
&& echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> $HOME/.bashrc

ENV CARGO_HOME=/root/.cargo
ENV RUSTUP_HOME=/root/.rustup
ENV PATH="/root/.cargo/bin:/root/.bun/bin:${PATH}"
ENV BUN_INSTALL=/root/.bun

36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "auth-rs DevContainer",
"dockerComposeFile": [
"docker-compose.yml"
],
"service": "dev",
"workspaceFolder": "/workspaces/auth-rs",
"customizations": {
"vscode": {
"settings": {
"editor.formatOnSave": true,
"rust-analyzer.checkOnSave.command": "clippy"
},
"extensions": [
"rust-lang.rust-analyzer",
"serayuzgur.crates",
"tamasfe.even-better-toml",
"svelte.svelte-vscode",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
},
"forwardPorts": [3000, 8000, 27017],
"portsAttributes": {
"3000": { "label": "Frontend" },
"8000": { "label": "Backend" },
"27017": { "label": "MongoDB" }
},
"postCreateCommand": "bun install",
"remoteEnv": {
"ROCKET_ADDRESS": "0.0.0.0",
"ROCKET_DATABASES": "{auth-rs-db={url=\"mongodb://mongodb:27017\"}}",
"PUBLIC_API_URL": "http://localhost:8000/api"
}
}
43 changes: 43 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
services:
dev:
build:
context: .
dockerfile: Dockerfile
image: localhost/auth-rs-dev:latest
container_name: auth-rs-dev
volumes:
- ..:/workspaces/auth-rs:cached
command: sleep infinity
networks:
- devnet
depends_on:
mongodb:
condition: service_healthy
environment:
- ROCKET_ADDRESS=0.0.0.0
- ROCKET_DATABASES={auth-rs-db={url="mongodb://mongodb:27017"}}
- PUBLIC_API_URL=http://localhost:8000/api
ports:
- "3000:3000"
- "8000:8000"

mongodb:
image: mongo:latest
container_name: auth-rs-dev-mongodb
volumes:
- mongodb_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- devnet

volumes:
mongodb_data:

networks:
devnet:
driver: bridge