Skip to content

Commit 5cfc1f8

Browse files
committed
Remove the default network from the devcontainer compose
And stop exposing the capybara server port to all interfaces. We were using this just to make sure the selenium container can access the capybara server but it can with the default bridge network.
1 parent f008c31 commit 5cfc1f8

File tree

5 files changed

+0
-43
lines changed

5 files changed

+0
-43
lines changed

.devcontainer/compose.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ services:
1212
# Overrides default command so things don't shut down after the process ends.
1313
command: sleep infinity
1414

15-
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
16-
networks:
17-
- default
18-
1915
depends_on:
2016
- postgres
2117
- mariadb
@@ -28,8 +24,6 @@ services:
2824
postgres:
2925
image: postgres:latest
3026
restart: unless-stopped
31-
networks:
32-
- default
3327
volumes:
3428
- postgres-data:/var/lib/postgresql/data
3529
environment:
@@ -40,8 +34,6 @@ services:
4034
mariadb:
4135
image: mariadb:latest
4236
restart: unless-stopped
43-
networks:
44-
- default
4537
volumes:
4638
- mariadb-data:/var/lib/mysql
4739
environment:
@@ -50,20 +42,13 @@ services:
5042
redis:
5143
image: redis:latest
5244
restart: unless-stopped
53-
networks:
54-
- default
5545
volumes:
5646
- redis-data:/data
5747

5848
memcached:
5949
image: memcached:latest
6050
restart: unless-stopped
6151
command: ["-m", "1024"]
62-
networks:
63-
- default
64-
65-
networks:
66-
default:
6752

6853
volumes:
6954
postgres-data:

railties/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,11 @@ services:
1212
# Overrides default command so things don't shut down after the process ends.
1313
command: sleep infinity
1414

15-
networks:
16-
- default
17-
1815
# Uncomment the next line to use a non-root user for all processes.
1916
# user: vscode
2017

2118
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
2219
# (Adding the "ports" property to this file will not forward from a Codespace.)
23-
ports:
24-
- 45678:45678
2520
<%- if !dependencies.empty? -%>
2621
depends_on:
2722
<%- dependencies.each do |dependency| -%>
@@ -33,16 +28,12 @@ services:
3328
selenium:
3429
image: seleniarm/standalone-chromium
3530
restart: unless-stopped
36-
networks:
37-
- default
3831
<%- end -%>
3932

4033
<%- if options[:redis] -%>
4134
redis:
4235
image: redis:7.2
4336
restart: unless-stopped
44-
networks:
45-
- default
4637
volumes:
4738
- redis-data:/data
4839

railties/test/fixtures/.devcontainer/compose-minimal.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@ services:
99

1010
# Overrides default command so things don't shut down after the process ends.
1111
command: sleep infinity
12-
13-
networks:
14-
- default

railties/test/fixtures/.devcontainer/compose.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,24 @@ services:
1010
# Overrides default command so things don't shut down after the process ends.
1111
command: sleep infinity
1212

13-
networks:
14-
- default
15-
1613
# Uncomment the next line to use a non-root user for all processes.
1714
# user: vscode
1815

1916
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
2017
# (Adding the "ports" property to this file will not forward from a Codespace.)
21-
ports:
22-
- 45678:45678
2318
depends_on:
2419
- selenium
2520
- redis
2621

2722
selenium:
2823
image: seleniarm/standalone-chromium
2924
restart: unless-stopped
30-
networks:
31-
- default
3225

3326
redis:
3427
image: redis:7.2
3528
restart: unless-stopped
36-
networks:
37-
- default
3829
volumes:
3930
- redis-data:/data
4031

41-
42-
43-
4432
volumes:
4533
redis-data:

railties/test/generators/app_generator_test.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,8 +1240,6 @@ def test_devcontainer
12401240
},
12411241
"volumes" => ["../..:/workspaces:cached"],
12421242
"command" => "sleep infinity",
1243-
"networks" => ["default"],
1244-
"ports" => ["45678:45678"],
12451243
"depends_on" => ["selenium", "redis"]
12461244
}
12471245

@@ -1250,15 +1248,13 @@ def test_devcontainer
12501248
expected_selenium_conifg = {
12511249
"image" => "seleniarm/standalone-chromium",
12521250
"restart" => "unless-stopped",
1253-
"networks" => ["default"]
12541251
}
12551252

12561253
assert_equal expected_selenium_conifg, compose_config["services"]["selenium"]
12571254

12581255
expected_redis_config = {
12591256
"image" => "redis:7.2",
12601257
"restart" => "unless-stopped",
1261-
"networks" => ["default"],
12621258
"volumes" => ["redis-data:/data"]
12631259
}
12641260

0 commit comments

Comments
 (0)