-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
100 lines (95 loc) · 3.51 KB
/
Copy pathdocker-compose.yml
File metadata and controls
100 lines (95 loc) · 3.51 KB
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
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Runs the Rebalancer Explorer backend and the JSON proxy together on a shared
# network. The proxy reaches the backend by its service name ("explorer").
#
# Services build their own images:
# REBALANCER_PROXY_AUTH_TOKEN=secret docker compose up --build
# explorer and bundles share the project compile via the "build-base" service;
# proxy is FROM rebalancer-explorer. All are pulled in via additional_contexts so
# bases build first.
#
# The bundle-seeder runs once, populates the shared "bundles" volume, and exits.
# The Explorer mounts that volume read-only at /bundles, so a client can load an
# example with manifoldId "/bundles/vertex_cover.bundle" (and similar).
#
# Only the proxy port (8081) is published; the backend stays internal.
services:
# Build-only base: compiles the shared C++ deps AND the project once; explorer
# and bundles consume its /artifacts/linux. Can't use a compose profile --
# additional_contexts "service:build-base" only resolves while the service is
# active. No runtime role, so its command is a no-op (it exits 0 on `up`).
build-base:
image: rebalancer-build
build:
context: .
dockerfile: Dockerfile.base
command: ["true"]
restart: "no"
# One-shot: copies the baked example bundles into the shared volume, then exits.
bundle-seeder:
image: rebalancer-bundles
build:
context: .
dockerfile: Dockerfile.bundles
# Resolves the bundles' `FROM rebalancer-build` to the shared build image.
additional_contexts:
rebalancer-build: "service:build-base"
volumes:
- bundles:/out
explorer:
image: rebalancer-explorer
build:
context: .
dockerfile: Dockerfile.explorer
# Resolves the explorer's `COPY --from=rebalancer-build` to the build image.
additional_contexts:
rebalancer-build: "service:build-base"
# No published ports: only the proxy talks to it, over the compose network.
expose:
- "8080"
# Wait for the seeder to finish populating the volume before starting.
depends_on:
bundle-seeder:
condition: service_completed_successfully
volumes:
- bundles:/bundles:ro
command: ["--port", "8080"]
proxy:
image: rebalancer-explorer-proxy
build:
context: .
dockerfile: Dockerfile.proxy
# Resolves the proxy's `FROM rebalancer-explorer` to the explorer build.
additional_contexts:
rebalancer-explorer: "service:explorer"
depends_on:
- explorer
ports:
- "8081:8081"
environment:
# Bearer token external callers must present. Provided from your shell;
# never commit a real token.
REBALANCER_PROXY_AUTH_TOKEN: "${REBALANCER_PROXY_AUTH_TOKEN}"
command:
- "--port"
- "8081"
- "--backend_host"
- "explorer"
- "--backend_port"
- "8080"
# Local testing only: bypass bearer-token auth. Remove for any real use.
- "--disable_auth"
volumes:
bundles: