-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/rust/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye | ||
ARG VARIANT="buster" | ||
FROM mcr.microsoft.com/vscode/devcontainers/rust:${VARIANT} | ||
|
||
# [Optional] Uncomment this section to install additional packages. | ||
RUN apt-get update && \ | ||
export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get -y install --no-install-recommends \ | ||
clang \ | ||
lld \ | ||
neovim\ | ||
postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
USER 1000 | ||
ENV HOME /home/vscode | ||
|
||
# Install cargo-binstall | ||
#RUN mkdir -p /usr/local/cargo/bin | ||
RUN wget -qO - "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz" | tar zxvf - -C /usr/local/cargo/bin | ||
# Install some cargo tools | ||
RUN cargo binstall -y cargo-deny | ||
RUN cargo binstall -y cargo-edit | ||
RUN cargo binstall -y cargo-whatfeatures | ||
RUN cargo binstall -y cargo-nextest | ||
|
||
# Can't use binstall due to unique requirements | ||
RUN cargo install sqlx-cli --no-default-features --features rustls,postgres | ||
|
||
# Setup neovim | ||
RUN mkdir -p $HOME/.config/nvim && \ | ||
echo "\ | ||
set number\n\ | ||
set relativenumber\n\ | ||
set expandtab\n\ | ||
set shiftwidth=4\n\ | ||
set tabstop=4\n\ | ||
set softtabstop=4\n\ | ||
"\ | ||
> $HOME/.config/nvim/init.vim | ||
|
||
# Install Act tool to run GH actions locally | ||
RUN curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/rust | ||
{ | ||
"name": "ocieguide Rust and Postgres", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "devcontainer", | ||
"workspaceFolder": "/workspace/ocieguide", | ||
// Configure tool-specific properties. | ||
"customizations": { | ||
// Configure properties specific to VS Code. | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"lldb.executable": "/usr/bin/lldb", | ||
// VS Code don't watch files under ./target | ||
"files.watcherExclude": { | ||
"**/target/**": true | ||
}, | ||
"rust-analyzer.checkOnSave.command": "clippy" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"vadimcn.vscode-lldb", | ||
"mutantdino.resourcemonitor", | ||
"rust-lang.rust-analyzer", | ||
"tamasfe.even-better-toml", | ||
"serayuzgur.crates", | ||
"vscode-icons-team.vscode-icons", | ||
"Gruntfuggly.todo-tree", | ||
"aeschli.vscode-css-formatter", | ||
"heaths.vscode-guid", | ||
"mohsen1.prettify-json", | ||
"redhat.vscode-yaml" | ||
] | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "SKIP_DOCKER=true cargo xtask postgres && cargo xtask redis", | ||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode", | ||
"features": { | ||
"docker-in-docker": "latest", | ||
"git": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '3.8' | ||
|
||
services: | ||
devcontainer: | ||
user: 1000:1000 | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
args: | ||
VARIANT: "bullseye" | ||
volumes: | ||
- ..:/workspace/ocieguide/:cached | ||
|
||
command: sleep infinity | ||
network_mode: service:db | ||
|
||
db: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
hostname: postgres | ||
environment: | ||
POSTGRES_DB: ocieguide | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASS: password | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
ports: | ||
- 5432:5432 | ||
|
||
volumes: | ||
postgres-data: null |