Skip to content

Commit 51dc39f

Browse files
committed
Ensure binding is always 0.0.0.0.
Binds the server to all IP addresses of the container, so it can be accessed from outside the container.
1 parent 8c7e394 commit 51dc39f

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
22
ARG RUBY_VERSION=<%= Gem.ruby_version %>
33
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION
4+
5+
# Ensure binding is always 0.0.0.0
6+
# Binds the server to all IP addresses of the container, so it can be accessed from outside the container.
7+
ENV BINDING="0.0.0.0"

railties/test/generators/app_generator_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ def test_devcontainer
13201320
end
13211321
assert_file(".devcontainer/Dockerfile") do |content|
13221322
assert_match(/ARG RUBY_VERSION=#{RUBY_VERSION}/, content)
1323+
assert_match(/ENV BINDING="0.0.0.0"/, content)
13231324
end
13241325
assert_file("test/application_system_test_case.rb") do |content|
13251326
assert_match(/^ served_by host: "rails-app", port: ENV\["CAPYBARA_SERVER_PORT"\]/, content)

railties/test/generators/devcontainer_generator_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def test_system_test_option_skip
346346
def test_common_config
347347
assert_file(".devcontainer/Dockerfile") do |dockerfile|
348348
assert_match(/ARG RUBY_VERSION=#{RUBY_VERSION}/, dockerfile)
349+
assert_match(/ENV BINDING="0.0.0.0"/, dockerfile)
349350
end
350351

351352
assert_devcontainer_json_file do |devcontainer_json|

0 commit comments

Comments
 (0)