This is a devcontainer for Rust and PostgreSQL development. It is based on the official Rust devcontainer and adds PostgreSQL.
Important: This container will only work with Podman.
- Install the Remote - Containers extension for Visual Studio Code.
- Add a
.devcontainer/devcontainer.json
file to your repository with the following content:
{
"image": "ghcr.io/edu4rdshl/rust-postgres-devcontainer:latest",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"rust-lang.rust-analyzer",
"ms-vscode.cpptools",
"vadimcn.vscode-lldb",
"ms-vscode.cmake-tools",
"twxs.cmake",
"fill-labs.dependi",
"tamasfe.even-better-toml",
"GitLab.gitlab-workflow",
"ms-ossdata.vscode-postgresql",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg"
]
}
},
// Mount the workspace folder into the container
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
"mounts": [
// Note: The volumes cargo-cache-rust_devcontainer and postgres-rust_devcontainer are automatically used
// to cache the cargo and postgresql data directories respectively. You can override them by setting the
// mounts here. Example:
// {
// "source": "cargo-cache-${localWorkspaceFolderBasename}",
// "target": "/usr/local/cargo:U",
// "type": "volume"
// },
// {
// "source": "postgres-${localWorkspaceFolderBasename}",
// "target": "/var/lib/postgresql/15/main:U",
// "type": "volume"
// }
],
"runArgs": [
"--restart=always",
"--name=devcontainer-${localWorkspaceFolderBasename}"
]
}
- Install devcontainer-cli by running
npm install -g @devcontainers/cli
. - Run
devcontainer up --workspace-folder .
in the repository root. - Attach to the devcontainer by clicking the green button in the bottom left corner of Visual Studio Code.
- You're ready to go!
- Rust
- PostgreSQL
- Diesel CLI
- Several useful bash_aliases
If you encounter any issues, please open an issue on the GitHub repository.