forked from windmill-labs/windmill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dev): setup devcontainer (windmill-labs#549)
Co-authored-by: ex0ns <[email protected]>
- Loading branch information
Showing
8 changed files
with
143 additions
and
8 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,42 @@ | ||
FROM python:3.10-slim-bullseye as nsjail | ||
|
||
WORKDIR /nsjail | ||
|
||
RUN apt-get -y update \ | ||
&& apt-get install -y \ | ||
bison \ | ||
flex \ | ||
g++ \ | ||
gcc \ | ||
git \ | ||
libprotobuf-dev \ | ||
libnl-route-3-dev \ | ||
make \ | ||
pkg-config \ | ||
protobuf-compiler \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN git clone -b master --single-branch https://github.com/google/nsjail.git . \ | ||
&& git checkout dccf911fd2659e7b08ce9507c25b2b38ec2c5800 | ||
RUN make | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/rust:bullseye as rust-deps | ||
|
||
RUN cargo install sqlx-cli --no-default-features --features native-tls,postgres | ||
RUN cargo install deno --locked | ||
|
||
FROM mcr.microsoft.com/vscode/devcontainers/rust:bullseye | ||
|
||
RUN apt update \ | ||
&& apt-get install -y \ | ||
lld \ | ||
python3 \ | ||
libprotobuf-dev \ | ||
libnl-route-3-dev \ | ||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* | ||
|
||
USER vscode | ||
|
||
COPY --from=rust-deps /usr/local/cargo/bin/sqlx /usr/local/cargo/bin/sqlx | ||
COPY --from=rust-deps /usr/local/cargo/bin/deno /usr/local/cargo/bin/deno | ||
COPY --from=nsjail /nsjail/nsjail /bin/nsjail |
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,25 @@ | ||
version: '3.7' | ||
services: | ||
windmill: | ||
build: | ||
context: . | ||
dockerfile: .devcontainer/Dockerfile | ||
# image: mcr.microsoft.com/vscode/devcontainers/rust:bullseye | ||
environment: | ||
- DENO_PATH=/usr/local/cargo/bin/deno | ||
- PYTHON_PATH=/usr/bin/python3 | ||
- NSJAIL_PATH=/bin/nsjail | ||
volumes: | ||
- .:/workspace:cached | ||
- ~/.ssh:/home/vscode/.ssh:ro | ||
|
||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
|
||
|
||
front: | ||
image: mcr.microsoft.com/vscode/devcontainers/typescript-node:16 | ||
volumes: | ||
- .:/workspace:cached | ||
- ~/.ssh:/home/node/.ssh:ro | ||
|
||
command: /bin/sh -c "while sleep 1000; do :; done" |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
target/ | ||
.DS_Store | ||
nohup.out | ||
local/ | ||
frontend/src/routes/test.svelte | ||
CaddyfileRemoteMalo |
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
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,27 @@ | ||
// 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/docker-existing-docker-compose | ||
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. | ||
{ | ||
"name": "Backend Container", | ||
"dockerComposeFile": [ | ||
"../docker-compose.yml", | ||
"../.devcontainer/docker-compose.yml" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"rust-lang.rust-analyzer", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} | ||
}, | ||
"service": "windmill", | ||
"workspaceFolder": "/workspace", | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ | ||
8000 | ||
], | ||
// "postCreateCommand": "sudo apt-get update && sudo apt-get install -y lld python3 && cargo install sqlx-cli --no-default-features --features native-tls,postgres && (cd backend && sqlx migrate run) && cargo install deno --locked && rustup toolchain install nightly-2022-05-23 -c rust-src -c rustc-dev -c llvm-tools-preview", | ||
"postCreateCommand": "cd backend && sqlx migrate run", | ||
"remoteUser": "vscode" | ||
} |
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,25 @@ | ||
// 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/docker-existing-docker-compose | ||
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. | ||
{ | ||
"name": "Frontend container", | ||
"dockerComposeFile": [ | ||
"../docker-compose.yml", | ||
"../.devcontainer/docker-compose.yml" | ||
], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [] | ||
} | ||
}, | ||
"service": "front", | ||
"workspaceFolder": "/workspace", | ||
"forwardPorts": [ | ||
8080 | ||
], | ||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down. | ||
// "shutdownAction": "none", | ||
"postCreateCommand": "cd frontend && npm install && npm run generate-backend-client && wget https://github.com/caddyserver/caddy/releases/download/v2.6.0-beta.3/caddy_2.6.0-beta.3_linux_amd64.deb -O /tmp/caddy.deb && sudo dpkg -i /tmp/caddy.deb && rm /tmp/caddy.deb", | ||
"postStartCommand": "nohup bash -c 'cd frontend && npm run dev &' && nohup bash -c 'caddy run --config frontend/CaddyfileDev &'", | ||
"remoteUser": "node" | ||
} |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
auto_https off | ||
auto_https off | ||
} | ||
|
||
:80 { | ||
bind {$ADDRESS} | ||
reverse_proxy /api/* http://localhost:8000 | ||
reverse_proxy /* http://localhost:3000 | ||
reverse_proxy /ws/* http://localhost:3001 { | ||
lb_policy header "Authorization" | ||
} | ||
|
||
} | ||
} |
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,12 @@ | ||
{ | ||
auto_https off | ||
} | ||
|
||
:8080 { | ||
bind {$ADDRESS} | ||
reverse_proxy /api/* http://windmill:8000 | ||
reverse_proxy /* http://localhost:3000 | ||
reverse_proxy /ws/* http://lsp:3001 { | ||
lb_policy header "Authorization" | ||
} | ||
} |