-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Add Devcontainer Support #1620
Open
aroop
wants to merge
3
commits into
bullet-train-co:main
Choose a base branch
from
aroop:main
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.
+172
−3
Open
Add Devcontainer Support #1620
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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,5 @@ | ||
# [Choice] Ruby version: 3, 3.3, 3.2, 3.1, 3.0, 2, 2.7, 2.6 | ||
ARG VARIANT="3.3.4" | ||
FROM ghcr.io/rails/devcontainer/images/ruby:${VARIANT} | ||
|
||
RUN apt-get update && apt-get install -y graphviz |
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,50 @@ | ||
services: | ||
rails: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
volumes: | ||
- ../..:/workspaces:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
|
||
depends_on: | ||
- postgres | ||
- redis | ||
# - memcached | ||
- selenium | ||
|
||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally. | ||
# (Adding the "ports" property to this file will not forward from a Codespace.) | ||
ports: | ||
- 45678:45678 | ||
|
||
selenium: | ||
image: seleniarm/standalone-chromium | ||
restart: unless-stopped | ||
|
||
redis: | ||
image: redis:latest | ||
restart: unless-stopped | ||
volumes: | ||
- redis-data:/data | ||
|
||
postgres: | ||
image: postgres:latest | ||
restart: unless-stopped | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
|
||
# memcached: | ||
# image: memcached:latest | ||
# restart: unless-stopped | ||
# command: ["-m", "1024"] | ||
|
||
volumes: | ||
postgres-data: | ||
redis-data: |
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,60 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. | ||
{ | ||
"name": "Untitled Application", | ||
"dockerComposeFile": "compose.yaml", | ||
"service": "rails", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/devcontainers/features/node:1": {}, | ||
"ghcr.io/rails/devcontainer/features/activestorage": {}, | ||
"ghcr.io/rails/devcontainer/features/postgres-client": {} | ||
}, | ||
|
||
// https://code.visualstudio.com/remote/advancedcontainers/environment-variables | ||
// https://containers.dev/implementors/json_reference/#variables-in-devcontainerjson | ||
"containerEnv": { | ||
"PGHOST": "postgres", | ||
"PGUSER": "postgres", | ||
"PGPASSWORD": "postgres", | ||
"REDIS_URL": "redis://redis/0", | ||
"CAPYBARA_SERVER_PORT": "45678", | ||
"SELENIUM_HOST": "selenium", | ||
// "MEMCACHE_SERVERS": "memcached:11211" | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
"forwardPorts": [ | ||
3000, | ||
5432, | ||
6379 | ||
], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "corepack enable && yarn set version 4.2.2 && bin/setup-devcontainer", | ||
|
||
// Configure tool-specific properties. | ||
"customizations": { | ||
"vscode": { | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"marcoroth.stimulus-lsp", | ||
"bradlc.vscode-tailwindcss", | ||
// "manuelpuyol.erb-linter", | ||
// "setobiralo.erb-commenter", | ||
// "streetsidesoftware.code-spell-checker", | ||
// "GitHub.copilot", | ||
// "GitHub.copilot-chat", | ||
// "donjayamanne.githistory", | ||
// "esbenp.prettier-vscode", | ||
// "jemmyw.rails-fast-nav", | ||
// "tmikoss.rails-latest-migration" | ||
] | ||
} | ||
} | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
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 +1 @@ | ||
3.3.3 | ||
3.3.4 |
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,44 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'bundler/inline' | ||
|
||
# First we require a util file that will install a few utility gems | ||
# and define some utility methods used by other scirpts. | ||
require "#{__dir__}/setup-scripts/utils" | ||
|
||
|
||
|
||
# path to your application root. | ||
APP_ROOT = File.expand_path("..", __dir__) | ||
|
||
|
||
|
||
FileUtils.chdir APP_ROOT do | ||
# This script is a way to set up or update your development environment automatically. | ||
# This script is idempotent, so that you can run it at any time and get an expectable outcome. | ||
# Add necessary setup steps to individual scripts in `bin/setup-scripts` and then `require` them below. | ||
|
||
# We need to check for the same version of ruby as bin/configure, so we | ||
# reuse this one from the configure-scritps directory. | ||
require "#{__dir__}/configure-scripts/check_ruby" | ||
require "#{__dir__}/setup-scripts/bundle_install" | ||
|
||
require "#{__dir__}/setup-scripts/check_node" | ||
require "#{__dir__}/setup-scripts/check_yarn" | ||
require "#{__dir__}/setup-scripts/yarn_install" | ||
|
||
# Now we check that you have base-level system dependencies installed. | ||
# Not needed for devcontainer, as we have a compose file with postgres and redis. | ||
# require "#{__dir__}/setup-scripts/check_postgres" | ||
# require "#{__dir__}/setup-scripts/check_redis" | ||
# require "#{__dir__}/setup-scripts/check_icu" | ||
|
||
require "#{__dir__}/setup-scripts/prepare_local_app" | ||
|
||
require "#{__dir__}/setup-scripts/build_assets" | ||
|
||
require "#{__dir__}/setup-scripts/check_overmind" | ||
|
||
puts "" | ||
puts "You're set! Now you can run bin/dev to boot your server and access your new application.".blue | ||
end |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd propose adding an env variable to improve the corepack prompt on the install process