Skip to content

Edu4rdSHL/rust-postgres-devcontainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Rust and PostgreSQL devcontainer

This is a devcontainer for Rust and PostgreSQL development. It is based on the official Rust devcontainer and adds PostgreSQL.

How to use

Important: This container will only work with Podman.

  1. Install the Remote - Containers extension for Visual Studio Code.
  2. 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}"
    ]
}
  1. Install devcontainer-cli by running npm install -g @devcontainers/cli.
  2. Run devcontainer up --workspace-folder . in the repository root.
  3. Attach to the devcontainer by clicking the green button in the bottom left corner of Visual Studio Code.
  4. You're ready to go!

What's included

  • Rust
  • PostgreSQL
  • Diesel CLI
  • Several useful bash_aliases

Issues

If you encounter any issues, please open an issue on the GitHub repository.

About

Devcontainer that contains a Rust + PostgreSQL setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published