-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add devcontainer for Codespaces #2948
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
goosys
wants to merge
15
commits into
thoughtbot:main
Choose a base branch
from
goosys:codespaces-devcontainer
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.
+88
−0
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
817f24a
Add devcontainer for Codespaces
goosys 05f7585
Update configuration for prebuild and rebuild compatibility
goosys 5e0981f
Add workaround for CSRF issue in current GitHub Codespaces
goosys 371a4d7
Add libvips to Codespace devcontainer
goosys 196b92a
Remove addition of ENV variables to .env
goosys 41ba822
Allow connections to forwarded ports in GitHub Codespaces
goosys 3dc15c2
Refile test database setup
goosys 843b1bd
Update Ruby version in devcontainer setup scripts
goosys 6951c5c
Workaround for install Ruby 4.0.0 with RVM
goosys 994bd1d
add labels
goosys c031e2c
Add workaround for Yarn GPG key error on apt update in devcontainer
goosys 37af0f1
Update .devcontainer/codespaces/devcontainer.json
goosys 51e4365
replace rv with rvm
goosys a65a40d
use universal:6
goosys 6d50565
Add CSRF workaround again
goosys 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,19 @@ | ||
| // For format details, see https://containers.dev/implementors/json_reference/. For config options, see the | ||
| // README at: https://github.com/devcontainers/templates/tree/main/src/universal | ||
| { | ||
| "name": "For Codespaces", | ||
|
|
||
| "image": "mcr.microsoft.com/devcontainers/universal:6", | ||
|
|
||
| "containerEnv": { | ||
| "DATABASE_URL": "postgresql://postgres:@localhost", | ||
| "COREPACK_ENABLE_DOWNLOAD_PROMPT": "0" | ||
| }, | ||
|
|
||
| "onCreateCommand": "bash --login .devcontainer/codespaces/onCreateCommand.sh", | ||
|
|
||
| "postCreateCommand": "bash --login .devcontainer/codespaces/postCreateCommand.sh", | ||
|
|
||
| "postStartCommand": "bash --login .devcontainer/codespaces/postStartCommand.sh" | ||
|
|
||
| } |
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 @@ | ||
| # Install Ruby via rv | ||
| curl -LsSf https://rv.dev/install | sh | ||
| source ~/.cargo/env | ||
| rv ruby list | ||
| rv ruby install 3.4.6 | ||
| rv ruby install 4.0.0 | ||
| rv ruby list | ||
| echo 'eval "$(rv shell init bash)"' >> ~/.bashrc | ||
| source ~/.bashrc | ||
| which ruby | ||
| ruby --version | ||
|
|
||
| # Workaround for Yarn GPG key | ||
| curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/yarnkey.gpg | ||
| echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | ||
| sudo apt update | ||
|
|
||
| # Install Google Chrome | ||
| wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/google-chrome.deb | ||
| sudo apt update && sudo apt install -y /tmp/google-chrome.deb && rm /tmp/google-chrome.deb | ||
| google-chrome --version | ||
|
|
||
| # Install Chromedriver | ||
| CHROMEDRIVER_VERSION=$(google-chrome --version | awk '{print $3}') | ||
| wget https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip | ||
| unzip chromedriver-linux64.zip | ||
| sudo mv chromedriver-linux64/chromedriver /usr/local/bin/ | ||
| rm -rf chromedriver-linux64.zip chromedriver-linux64 | ||
| chromedriver --version | ||
|
|
||
| # Install libs | ||
| sudo apt install -y libvips | ||
|
|
||
| # Cleanup | ||
| sudo apt-get clean | ||
| sudo rm -rf /var/lib/apt/lists/* |
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,19 @@ | ||
| # Init ruby via rv | ||
| source "$HOME/.cargo/env" | ||
| eval "$(rv shell init bash)" | ||
|
|
||
| # Wait for Docker to be ready and start PostgreSQL container | ||
| until docker info >/dev/null 2>&1; do sleep 1; done | ||
| docker rm postgres >/dev/null 2>&1 | ||
| docker run -d -i --name postgres -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres | ||
| until docker exec postgres pg_isready -U postgres; do sleep 1; done | ||
|
|
||
| # Create config/database.yml | ||
| ./bin/setup | ||
| # Setup & Create .env | ||
| ./bin/setup | ||
|
|
||
| # Create test database and run seeds | ||
| RAILS_ENV=test ./bin/rails dev:prime | ||
|
|
||
| docker stop postgres | ||
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,2 @@ | ||
|
|
||
| docker start postgres |
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
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.