-
Notifications
You must be signed in to change notification settings - Fork 278
Introduce DevContainers #3429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brawaru
wants to merge
1
commit into
modrinth:main
Choose a base branch
from
brawaru:chore/devcontainers/intro
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Introduce DevContainers #3429
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,14 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:1-bookworm | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev \ | ||
build-essential \ | ||
curl \ | ||
wget \ | ||
file \ | ||
libxdo-dev \ | ||
libssl-dev \ | ||
libayatana-appindicator3-dev \ | ||
librsvg2-dev \ | ||
luakit \ | ||
xdg-utils |
This file contains hidden or 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,54 @@ | ||
{ | ||
"name": "Modrinth (app, local)", | ||
|
||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
|
||
"hostRequirements": { | ||
"memory": "12gb" | ||
}, | ||
|
||
"features": { | ||
"ghcr.io/devcontainers/features/node": { | ||
"version": "20", | ||
"installYarnUsingApt": false, | ||
"pnpmVersion": "none" | ||
}, | ||
"ghcr.io/devcontainers/features/rust:1": {} | ||
}, | ||
|
||
"containerEnv": { | ||
"BROWSER_BASE_URL": "https://api.modrinth.com/v2/", | ||
"DATABASE_URL": "sqlite://${containerWorkspaceFolder}/apps/app/.data/database.db" | ||
}, | ||
|
||
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/app-shared/setup.sh", | ||
"updateContentCommand": "pnpm install --ignore-scripts && (cd apps/app && cargo fetch) && (cd apps/app-playground && cargo fetch)", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"Vue.volar", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"EditorConfig.EditorConfig", | ||
"tauri-apps.tauri-vscode", | ||
"-tamasfe.even-better-toml", | ||
"tombi-toml.tombi" | ||
], | ||
"settings": { | ||
"extensions.ignoreRecommendations": true, | ||
"rust-analyzer.files.exclude": ["apps/daedalus_client", "apps/labrinth"] | ||
} | ||
} | ||
}, | ||
|
||
"mounts": [ | ||
{ | ||
"source": "devcontainer-cargo-cache-modrinth", | ||
"target": "/usr/local/cargo", | ||
"type": "volume" | ||
} | ||
] | ||
} |
This file contains hidden or 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,15 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
npm i -g corepack | ||
|
||
corepack enable | ||
|
||
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack install | ||
|
||
cargo install --git https://github.com/launchbadge/sqlx sqlx-cli \ | ||
--no-default-features --features sqlite,rustls | ||
|
||
mkdir -p "$(dirname "${DATABASE_URL#sqlite://}")" | ||
|
||
(cd packages/app-lib && cargo sqlx database setup) |
This file contains hidden or 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,14 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:1-bookworm | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev \ | ||
build-essential \ | ||
curl \ | ||
wget \ | ||
file \ | ||
libxdo-dev \ | ||
libssl-dev \ | ||
libayatana-appindicator3-dev \ | ||
librsvg2-dev \ | ||
luakit \ | ||
xdg-utils |
This file contains hidden or 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,66 @@ | ||
{ | ||
"name": "Modrinth (app, remote)", | ||
|
||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
|
||
"hostRequirements": { | ||
"memory": "12gb" | ||
}, | ||
|
||
"features": { | ||
"ghcr.io/devcontainers/features/desktop-lite:1": {}, | ||
"ghcr.io/devcontainers/features/node": { | ||
"version": "20", | ||
"installYarnUsingApt": false, | ||
"pnpmVersion": "none" | ||
}, | ||
"ghcr.io/devcontainers/features/rust:1": {} | ||
}, | ||
|
||
"containerEnv": { | ||
"VNC_RESOLUTION": "1600x1000", | ||
"BROWSER_BASE_URL": "https://api.modrinth.com/v2/", | ||
"DATABASE_URL": "sqlite://${containerWorkspaceFolder}/apps/app/.data/database.db" | ||
}, | ||
|
||
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/app-shared/setup.sh", | ||
"updateContentCommand": "pnpm install --ignore-scripts && (cd apps/app && cargo fetch) && (cd apps/app-playground && cargo fetch)", | ||
|
||
"forwardPorts": [6080, 5901], | ||
"portsAttributes": { | ||
"6080": { | ||
"label": "desktop" | ||
}, | ||
"5901": { | ||
"label": "vnc" | ||
} | ||
}, | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"Vue.volar", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"EditorConfig.EditorConfig", | ||
"tauri-apps.tauri-vscode", | ||
"-tamasfe.even-better-toml", | ||
"tombi-toml.tombi" | ||
], | ||
"settings": { | ||
"extensions.ignoreRecommendations": true, | ||
"rust-analyzer.files.exclude": ["apps/daedalus_client", "apps/labrinth"] | ||
} | ||
} | ||
}, | ||
|
||
"mounts": [ | ||
{ | ||
"source": "devcontainer-cargo-cache-modrinth", | ||
"target": "/usr/local/cargo", | ||
"type": "volume" | ||
} | ||
] | ||
} |
This file contains hidden or 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,8 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:1-bookworm | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
postgresql-client \ | ||
libssl-dev \ | ||
pkg-config \ | ||
liblzma-dev |
This file contains hidden or 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,36 @@ | ||
{ | ||
"name": "Modrinth (backend)", | ||
|
||
"dockerComposeFile": ["../../docker-compose.yml", "docker-compose.yml"], | ||
"service": "labrinth", | ||
"workspaceFolder": "/workspace", | ||
|
||
"hostRequirements": { | ||
"memory": "12gb" | ||
}, | ||
|
||
"features": { | ||
"ghcr.io/devcontainers/features/rust:1": {} | ||
}, | ||
|
||
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/backend/setup.sh", | ||
"updateContentCommand": "(cd apps/labrinth && cargo fetch)", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": ["EditorConfig.EditorConfig", "-tamasfe.even-better-toml", "tombi-toml.tombi"], | ||
"settings": { | ||
"extensions.ignoreRecommendations": true, | ||
"rust-analyzer.files.exclude": ["apps/app", "apps/app-playground", "packages/app-lib"] | ||
} | ||
} | ||
}, | ||
|
||
"mounts": [ | ||
{ | ||
"source": "devcontainer-cargo-cache-modrinth", | ||
"target": "/usr/local/cargo", | ||
"type": "volume" | ||
} | ||
] | ||
} |
This file contains hidden or 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,20 @@ | ||
services: | ||
labrinth: | ||
build: | ||
dockerfile: ./.devcontainer/backend/Dockerfile | ||
command: sleep infinity | ||
volumes: | ||
- .:/workspace:cached | ||
depends_on: | ||
- postgres_db | ||
- meilisearch | ||
- redis | ||
- clickhouse | ||
environment: | ||
DATABASE_URL: postgresql://labrinth:labrinth@postgres_db/labrinth | ||
MEILISEARCH_ADDR: http://meilisearch:7700 | ||
REDIS_URL: redis://redis | ||
CLICKHOUSE_URL: http://clickhouse:8123 | ||
clickhouse: | ||
environment: | ||
- CLICKHOUSE_SKIP_USER_SETUP=1 |
This file contains hidden or 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,13 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
cargo install --git https://github.com/launchbadge/sqlx sqlx-cli \ | ||
--no-default-features --features postgres,rustls | ||
|
||
(cd apps/labrinth && sqlx database setup) | ||
|
||
psql "$DATABASE_URL" <<EOF | ||
INSERT INTO loaders VALUES (0, 'placeholder_loader'); | ||
INSERT INTO loaders_project_types VALUES (0, 1); -- modloader id, supported type id | ||
INSERT INTO categories VALUES (0, 'placeholder_category', 1); -- category id, category, project type id | ||
EOF |
This file contains hidden or 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,38 @@ | ||
{ | ||
"name": "Modrinth (frontend)", | ||
|
||
"image": "mcr.microsoft.com/devcontainers/base:1-bookworm", | ||
|
||
"features": { | ||
"ghcr.io/devcontainers/features/node": { | ||
"version": "20", | ||
"installYarnUsingApt": false, | ||
"pnpmVersion": "none" | ||
} | ||
}, | ||
|
||
"containerEnv": { | ||
"BROWSER_BASE_URL": "https://api.modrinth.com/v2/" | ||
}, | ||
|
||
"onCreateCommand": "npm i -g corepack && corepack enable && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack install", | ||
"updateContentCommand": "pnpm install --ignore-scripts && pnpm --filter=@modrinth/frontend postinstall", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"Vue.volar", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"EditorConfig.EditorConfig", | ||
"Nuxtr.nuxtr-vscode", | ||
"antfu.goto-alias" | ||
], | ||
"settings": { | ||
"extensions.ignoreRecommendations": true | ||
} | ||
} | ||
}, | ||
|
||
"appPort": [3000] | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -61,3 +61,5 @@ app-playground-data/* | |
apps/frontend/.env | ||
|
||
.astro | ||
|
||
.pnpm-store |
This file contains hidden or 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,3 +1,21 @@ | ||
{ | ||
"recommendations": ["esbenp.prettier-vscode", "Vue.volar", "rust-lang.rust-analyzer"] | ||
"recommendations": [ | ||
// Code style enforcers | ||
"EditorConfig.EditorConfig", | ||
"esbenp.prettier-vscode", | ||
"dbaeumer.vscode-eslint", | ||
// Vue + Nuxt development | ||
"Vue.volar", | ||
"Nuxtr.nuxtr-vscode", | ||
"antfu.goto-alias", | ||
// Rust development | ||
"rust-lang.rust-analyzer", | ||
"tombi-toml.tombi", | ||
"tauri-apps.tauri-vscode" | ||
], | ||
"unwantedRecommendations": [ | ||
// Even Better TOML has a memory leak and is unmaintained. | ||
// It is replaced by Tombi. | ||
"tamasfe.even-better-toml" | ||
] | ||
} |
This file contains hidden or 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,8 +1,52 @@ | ||
{ | ||
"prettier.endOfLine": "lf", | ||
"editor.formatOnSave": true, | ||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
|
||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.hg": true, | ||
"**/.DS_Store": true, | ||
"**/Thumbs.db": true, | ||
"**/.idea": true, | ||
"**/.pnpm-store": true, | ||
"**/.turbo": true, | ||
"**/node_modules": true, | ||
"**/target": true | ||
}, | ||
|
||
"explorer.fileNesting.enabled": true, | ||
"explorer.fileNesting.patterns": { | ||
"*.ts": "${capture}.js", | ||
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts", | ||
"*.jsx": "${capture}.js", | ||
"*.tsx": "${capture}.ts", | ||
"tsconfig.json": "tsconfig.*.json", | ||
"package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, bun.lock, pnpm-workspace.yaml", | ||
"Cargo.toml": "Cargo.lock", | ||
"README.md": "COPYING.md, LICENSE" | ||
}, | ||
|
||
"prettier.endOfLine": "lf", | ||
|
||
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"], | ||
"eslint.run": "onSave", | ||
|
||
"[json]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[jsonc]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[vue]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.