Create devcontainer
This commit is contained in:
parent
f6cf5fc874
commit
a5d5f7c0b1
|
|
@ -0,0 +1,2 @@
|
||||||
|
[build]
|
||||||
|
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
POSTGRES_USER=postgres
|
||||||
|
POSTGRES_PASSWORD=postgres
|
||||||
|
POSTGRES_DB=postgres
|
||||||
|
POSTGRES_HOSTNAME=localhost
|
||||||
|
POSTGRES_PORT=5432
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
|
||||||
|
ARG VARIANT="bullseye"
|
||||||
|
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
|
||||||
|
|
||||||
|
# Include lld linker to improve build times either by using environment variable
|
||||||
|
# RUSTFLAGS="-C link-arg=-fuse-ld=lld" or with Cargo's configuration file (i.e see .cargo/config.toml).
|
||||||
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -y install clang lld \
|
||||||
|
&& apt-get autoremove -y && apt-get clean -y
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
// 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.245.2/containers/rust-postgres
|
||||||
|
{
|
||||||
|
"name": "Rust and PostgreSQL",
|
||||||
|
"dockerComposeFile": "docker-compose.yml",
|
||||||
|
"service": "app",
|
||||||
|
"workspaceFolder": "/workspace",
|
||||||
|
|
||||||
|
// 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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [5432],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "rustc --version",
|
||||||
|
|
||||||
|
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"features": {
|
||||||
|
"docker-in-docker": "latest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres-data:
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
# Use the VARIANT arg to pick a Debian OS version: buster, bullseye
|
||||||
|
# Use bullseye when on local on arm64/Apple Silicon.
|
||||||
|
VARIANT: bullseye
|
||||||
|
env_file:
|
||||||
|
# Ensure that the variables in .env match the same variables in devcontainer.json
|
||||||
|
- .env
|
||||||
|
# Security Opt and cap_add for C++ based debuggers to work.
|
||||||
|
# See `runArgs`: https://github.com/Microsoft/vscode-docs/blob/main/docs/remote/devcontainerjson-reference.md
|
||||||
|
# security_opt:
|
||||||
|
# - seccomp:unconfined
|
||||||
|
# cap_add:
|
||||||
|
# - SYS_PTRACE
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ..:/workspace:cached
|
||||||
|
|
||||||
|
# Overrides default command so things don't shut down after the process ends.
|
||||||
|
command: sleep infinity
|
||||||
|
|
||||||
|
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||||
|
network_mode: service:db
|
||||||
|
|
||||||
|
# Uncomment the next line to use a non-root user for all processes.
|
||||||
|
# user: vscode
|
||||||
|
|
||||||
|
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||||
|
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:14.1
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
env_file:
|
||||||
|
# Ensure that the variables in .env match the same variables in devcontainer.json
|
||||||
|
- .env
|
||||||
|
|
||||||
|
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||||
|
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"workbench.colorCustomizations": {
|
||||||
|
"statusBar.background": "#1D856D",
|
||||||
|
"statusBar.foreground": "#fff",
|
||||||
|
"activityBar.background": "#1D856D",
|
||||||
|
"activityBar.foreground": "#fff"
|
||||||
|
},
|
||||||
|
"now.instance.user.name": "",
|
||||||
|
"now.instance.host.url": "",
|
||||||
|
"now.instance.OAuth.client.id": "",
|
||||||
|
"now.instance.user.password": "",
|
||||||
|
"now.instance.OAuth.client.secret": ""
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"ALL_APPLICATIONS":{},"ACTIVE_APPLICATION":""}
|
||||||
Loading…
Reference in New Issue