forked from rubyforgood/casa
-
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: add devcontainers (rubyforgood#5801)
Most of dev container code sourced from HE https://github.com/rubyforgood/human-essentials/tree/main/.devcontainer and Rails 7.2.beta https://github.com/rails/rails/tree/main/.devcontainer Needed to add values from rails/rails with otherwise the node version was very out of date Had to disable CSRF in dev (pretty yikes). Otherwise logins from whatever-github.app.dev would not work.
- Loading branch information
1 parent
f139bcf
commit 504af69
Showing
6 changed files
with
93 additions
and
0 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,6 @@ | ||
# This is the .env that is used by the codespaces environment. | ||
# See the .devcontainer/devcontainer.json file for how this is configured. | ||
PG_USERNAME=postgres | ||
PG_PASSWORD=postgres | ||
DELAYED_JOB_USERNAME='admin' | ||
DELAYED_JOB_PASSWORD='password' |
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,2 @@ | ||
FROM mcr.microsoft.com/devcontainers/ruby:dev-3.2-buster | ||
RUN apt -y update && apt install -y vim curl gpg postgresql postgresql-contrib tzdata imagemagick |
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,33 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/postgres | ||
{ | ||
"dockerComposeFile": "docker-compose.yml", | ||
"forwardPorts": [3000, 5432], | ||
"workspaceFolder": "/workspaces/casa", | ||
"service": "app", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": ["Shopify.ruby-extensions-pack"], | ||
"settings": { | ||
"rubyLsp.rubyVersionManager": { | ||
"identifier": "rvm" | ||
} | ||
} | ||
} | ||
}, | ||
"containerEnv": { | ||
"DATABASE_HOST": "postgres", | ||
"POSTGRES_USER": "postgres", | ||
"POSTGRES_PASSWORD": "postgres" | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": { | ||
"version": "latest" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"version": "latest" | ||
} | ||
}, | ||
|
||
"postCreateCommand": ".devcontainer/post-create.sh" | ||
} |
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,33 @@ | ||
version: "3.8" | ||
|
||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
volumes: | ||
- ../..:/workspaces:cached | ||
|
||
# Overrides default command so things don't shut down after the process ends. | ||
command: sleep infinity | ||
networks: | ||
- default | ||
|
||
postgres: | ||
image: postgres:latest | ||
restart: always | ||
networks: | ||
- default | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
POSTGRES_PASSWORD: postgres | ||
# Note that these ports are ignored by the devcontainer. | ||
# Instead, the ports are specified in .devcontainer/devcontainer.json. | ||
# ports: | ||
# - "5432:5432" | ||
volumes: | ||
postgres-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,14 @@ | ||
RUBY_VERSION="$(cat .ruby-version | tr -d '\n')" | ||
|
||
# copy the file only if it doesn't already exist | ||
cp -n .devcontainer/.env.codespaces .env | ||
|
||
# If the project's required ruby version changes from 3.2.2, this command | ||
# will download and compile the correct version, but it will take a long time. | ||
if [ "$RUBY_VERSION" != "3.2.2" ]; then | ||
rvm install $RUBY_VERSION | ||
rvm use $RUBY_VERSION | ||
echo "Ruby $RUBY_VERSION installed" | ||
fi | ||
|
||
bin/setup |
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