Skip to content

Commit

Permalink
Adding devcontainers
Browse files Browse the repository at this point in the history
  • Loading branch information
cirdes committed Jul 1, 2024
1 parent 5d4e417 commit 1acb959
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
ARG RUBY_VERSION=3.3.0
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION
57 changes: 57 additions & 0 deletions .devcontainer/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "phlexui-web"

services:
rails-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

# Uncomment the next line to use a non-root user for all processes.
# user: vscode

# 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
depends_on:
- selenium
- redis
- postgres

selenium:
image: seleniarm/standalone-chromium
restart: unless-stopped
networks:
- default

redis:
image: redis:7.2
restart: unless-stopped
networks:
- default
volumes:
- redis-data:/data

postgres:
image: postgres:16.1
restart: unless-stopped
networks:
- default
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

volumes:
redis-data:
postgres-data:
48 changes: 48 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
{
"name": "phlexui-web",
"dockerComposeFile": "compose.yaml",
"service": "rails-app",
"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/rails/devcontainer/features/activestorage": {},
"ghcr.io/rails/devcontainer/features/postgres-client": {}
},

"containerEnv": {
"CAPYBARA_SERVER_PORT": "45678",
"SELENIUM_HOST": "selenium",
"REDIS_URL": "redis://redis:6379/1",
"DB_HOST": "postgres"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 5432, 6379],

// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
"extensions": [
"Shopify.ruby-lsp",
"testdouble.vscode-standard-ruby"
]
},
"settings": {
"rubyLsp.rubyVersionManager": {
"identifier": "rbenv"
}
}
},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root",


// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bin/setup"
}
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ gem "rack-www" # used to redirect www to non-www subdomain
gem "rollbar"

gem "phlex-rails"
gem "phlex_ui"
# gem "phlex_ui"
# gem "phlex_ui", path: "../phlex_ui"
gem "phlex_ui", git: "https://github.com/PhlexUI/phlex_ui.git"
32 changes: 11 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
GIT
remote: https://github.com/PhlexUI/phlex_ui.git
revision: ab73874f4a437a92c8c721fff8f37cfad6196cd1
specs:
phlex_ui (0.1.10)
activesupport (>= 6.0)
phlex (~> 1.10)
rouge (~> 4.2.0)
zeitwerk (~> 2.6)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -92,7 +102,6 @@ GEM
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.1)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
Expand Down Expand Up @@ -164,7 +173,6 @@ GEM
octokit (5.6.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
paco (0.2.3)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
Expand All @@ -174,11 +182,6 @@ GEM
phlex-rails (1.2.1)
phlex (~> 1.10.0)
railties (>= 6.1, < 8)
phlex_ui (0.1.8)
phlex (~> 1.10)
rouge (~> 4.2.0)
ruby-next (~> 1.0)
zeitwerk (~> 2.6)
postmark (1.25.0)
json
postmark-rails (0.22.1)
Expand Down Expand Up @@ -234,7 +237,6 @@ GEM
regexp_parser (2.8.3)
reline (0.4.1)
io-console (~> 0.5)
require-hooks (0.2.2)
rexml (3.2.6)
rollbar (3.4.2)
rouge (4.2.1)
Expand All @@ -254,15 +256,6 @@ GEM
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-next (1.0.2)
paco (~> 0.2)
require-hooks (~> 0.2)
ruby-next-core (= 1.0.2)
ruby-next-parser (>= 3.2.2.0)
unparser (~> 0.6.0)
ruby-next-core (1.0.2)
ruby-next-parser (3.2.2.0)
parser (>= 3.0.3.1)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand Down Expand Up @@ -305,9 +298,6 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unparser (0.6.13)
diff-lcs (~> 1.3)
parser (>= 3.3.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -342,7 +332,7 @@ DEPENDENCIES
octokit (~> 5.0)
pg (~> 1.1)
phlex-rails
phlex_ui
phlex_ui!
postmark-rails
pry
puma (~> 5.0)
Expand Down
6 changes: 6 additions & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ default: &default
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
<% if ENV["DB_HOST"] %>
host: <%= ENV["DB_HOST"] %>
username: postgres
password: postgres
<% end %>


development:
<<: *default
Expand Down

0 comments on commit 1acb959

Please sign in to comment.