mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 12:54:51 +08:00
DEV: Overhaul devcontainer configuration (#28446)
- Uses a more appropriate image, with immutable tag (so update prompts work correctly) - Updates port forwarding - Improves mount setup (inc. persistant PG/Redis when rebuilding) - Fixes ember-cli live reload - Automatically configures VSCode & extensions
This commit is contained in:
@ -1,16 +1,37 @@
|
||||
{
|
||||
"name": "Discourse",
|
||||
"image": "discourse/discourse_dev:release",
|
||||
"workspaceMount": "source=${localWorkspaceFolder}/../..,target=/var/www/discourse,type=bind",
|
||||
"workspaceFolder": "/var/www/discourse",
|
||||
"settings": {
|
||||
"search.followSymlinks": false
|
||||
},
|
||||
"postStartCommand": "sudo /sbin/boot",
|
||||
"extensions": ["rebornix.Ruby"],
|
||||
"forwardPorts": [9292],
|
||||
"image": "docker.io/discourse/discourse_dev:20241111-0710",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/discourse,type=bind",
|
||||
"workspaceFolder": "/workspace/discourse",
|
||||
"postStartCommand": "./.devcontainer/scripts/start.rb",
|
||||
"forwardPorts": [
|
||||
9292, // bin/unicorn
|
||||
3000, // bin/rails s
|
||||
4200, // ember-cli
|
||||
8025, // mailhog
|
||||
9229 // chrome remote debug
|
||||
],
|
||||
"remoteUser": "discourse",
|
||||
"remoteEnv": {
|
||||
"DISCOURSE_DEV_HOSTS": ".githubpreview.dev"
|
||||
"RAILS_DEVELOPMENT_HOSTS": ".app.github.dev",
|
||||
"PGUSER": "discourse",
|
||||
"SELENIUM_FORWARD_DEVTOOLS_TO_PORT": "9229",
|
||||
},
|
||||
"mounts": [
|
||||
"source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
|
||||
"source=${localWorkspaceFolderBasename}-pg,target=/shared/postgres_data,type=volume",
|
||||
"source=${localWorkspaceFolderBasename}-redis,target=/shared/redis,type=volume"
|
||||
],
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"Shopify.ruby-lsp",
|
||||
"esbenp.prettier-vscode",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"ruby-syntax-tree.vscode-syntax-tree",
|
||||
"lifeart.vscode-glimmer-syntax",
|
||||
"typed-ember.glint-vscode"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
.devcontainer/scripts/start.rb
Executable file
27
.devcontainer/scripts/start.rb
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
puts "👋 Welcome to the Discourse devcontainer! Let's get everything ready..."
|
||||
|
||||
puts "Setting permissions on volume mounts..."
|
||||
system "sudo chown discourse .", exception: true
|
||||
system "sudo chown discourse node_modules", exception: true
|
||||
system "sudo chown -R postgres /shared/postgres_data", exception: true
|
||||
|
||||
puts "Starting services..."
|
||||
fork do
|
||||
Process.daemon
|
||||
exec "sudo nohup /sbin/boot"
|
||||
end
|
||||
|
||||
system "cp -n .vscode/settings.json.sample .vscode/settings.json", exception: true
|
||||
system "cp -n .vscode/tasks.json.sample .vscode/tasks.json", exception: true
|
||||
|
||||
puts <<~TXT
|
||||
🎉 All done!
|
||||
|
||||
Next steps:
|
||||
1. Cmd/Ctrl + Shift + B to run the shortcuts/boot-dev task
|
||||
2. Wait for the server to start
|
||||
3. Open your browser to http://localhost:4200
|
||||
TXT
|
Reference in New Issue
Block a user