-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
158 lines (129 loc) · 4.36 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
volumes:
postgres-data:
vscode-extensions:
vscode-insiders-extensions:
services:
postgres:
image: postgres:14-alpine
volumes:
# We'll store the postgres data in the 'postgres_data' volume we defined:
- type: volume
source: postgres-data
target: /var/lib/postgresql/data
- ./db/dumps:/db/dumps
- ./bin/dumpdb:/usr/local/bin/dumpdb:ro
- ./bin/restoredb:/usr/local/bin/restoredb:ro
ports:
- published: ${RAILS_GOOGLE_CLOUD_QUICKSTART_PG_PORT:-5432}
target: 5432
environment:
POSTGRES_USER: ${USER:-you}
POSTGRES_HOST_AUTH_METHOD: trust
# See https://docs.docker.com/compose/profiles/
# profiles:
# - ci
# - testing
# - staging
# - development
chrome:
image: icalialabs/chromium:93.0.4577.82
ports:
- published: ${RAILS_GOOGLE_CLOUD_QUICKSTART_CHROME_WEB_PORT:-9222}
target: 9222
# Mount application source code to support file uploading
# (otherwise Chrome won't be able to find files).
# NOTE: Make sure you use absolute paths in `#attach_file`.
volumes:
- type: bind
source: .
target: /workspaces/rails-google-cloud-quickstart
environment:
PORT: 9222
# Set connection timeout to avoid timeout exception during debugging
# https://docs.browserless.io/docs/docker.html#connection-timeout
CONNECTION_TIMEOUT: 600000
# profiles:
# - ci
# - testing
# - development
# The tests container:
tests: &app
build: &app-build
context: .
dockerfile: Dockerfile
target: development #testing
args:
DEVELOPER_UID: ${UID:-1000}
DEVELOPER_USERNAME: ${USER:-you}
image: icalialabs/rails-google-cloud-quickstart${TESTING_IMAGE_TAG:-:testing}
volumes:
# Mount the app code into the app containers:
- .:/workspaces/rails-google-cloud-quickstart
# Keep the stdin open, so we can attach to our app container's process
# and do things such as byebug, etc:
stdin_open: true
# Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container:
tty: true
# Required for ptrace-based debuggers like C++, Go, and Rust
cap_add:
- SYS_PTRACE
- NET_ADMIN
security_opt:
- seccomp:unconfined
entrypoint: /workspaces/rails-google-cloud-quickstart/bin/dev-entrypoint
# Link to our postgres and redis services, so they can be visible from our
# app service containers:
depends_on:
- chrome
- postgres
# The command we want to execute by default when running the container
command: rspec
# Specify environment variables available for our app containers. We'll
# leave a YML anchor in case we need to override or add more variables if
# needed on each app service:
environment: &app-env
RAILS_LOG_TO_STDOUT: "true"
DEBIAN_FRONTEND: dialog
# Tells the test suite to use the "chrome" service instead of a local
# chrome install:
CHROME_URL: http://chrome:9222
CHROME_PUBLIC_URL: ${RAILS_GOOGLE_CLOUD_QUICKSTART_CHROME_PUBLIC_URL:-http://localhost:9222}
DATABASE_URL: postgres://postgres:5432/?encoding=unicode
GOOGLE_CLOUD_PROJECT: rails-google-cloud-quickstart
# profiles:
# - ci
# - testing
# The Visual Studio Code / GitHub Codespaces development container:
devcontainer:
<<: *app
build:
<<: *app-build
target: development
volumes:
- .:/workspaces/rails-google-cloud-quickstart
- vscode-extensions:/home/${USER:-you}/.vscode-server/extensions
- vscode-insiders-extensions:/home/${USER:-you}/.vscode-server-insiders/extensions
image: icalialabs/rails-google-cloud-quickstart:development
# The command we want to execute by default when running the container
command: /bin/sh -c "while sleep 1000; do :; done"
environment:
<<: *app-env
EDITOR: code --wait
# profiles:
# - development
# The releasable container:
web-staging:
<<: *app
build:
<<: *app-build
target: release
ports:
- published: ${RAILS_GOOGLE_CLOUD_QUICKSTART_WEB_PORT:-3000}
target: 3000
depends_on:
- postgres
environment:
<<: *app-env
DATABASE_URL: postgres://${USER:-you}@postgres:5432/rails_google_cloud_quickstart_development?encoding=unicode
# profiles:
# - staging