graphql-engine/v3/ci.docker-compose.yaml
Samir Talwar 572fc54a54 Speed up debug builds in Docker. (#484)
This splits out a `debug.Dockerfile` which makes use of out-of-band
caching to speed up builds drastically, at the expense of
reproducibility.

It is used to run tests and auxiliary test services (i.e. the custom
connector).

The new `debug.Dockerfile` marks the Cargo dependency and build caches
as Docker caches, which means they are shared between builds. This is
probably fine for local work and testing. The `Dockerfile` continues to
not use a cache like this, to guarantee that it is not polluted by extra
information, at the expense of build speed.

In addition, we build a `nextest` archive ahead of time to avoid
building tests when attempting to run them.

On my machine, a re-run of `just test` now takes seconds.

I have also sped up the `postgres` container start time by creating a
database called "finished" last, and then waiting for that to show up.

V3_GIT_ORIGIN_REV_ID: 7ef0548361987175b68a0cad44c8f2295110a1fb
2024-04-22 13:43:29 +00:00

65 lines
1.5 KiB
YAML

services:
postgres:
extends:
file: ./docker-compose.yaml
service: postgres
postgres_connector:
image: ghcr.io/hasura/ndc-postgres:dev-main
ports:
- 8080:8080
environment:
CONNECTION_URI: "postgresql://postgres:password@postgres"
volumes:
- type: bind
source: ./crates/engine/tests/ndc-postgres-configuration
target: /etc/connector
read_only: true
depends_on:
postgres:
condition: service_healthy
custom_connector:
build:
dockerfile: debug.Dockerfile
entrypoint:
- ./bin/custom-connector
ports:
- "8101:8101"
healthcheck:
test: curl -fsS http://localhost:8101/schema
start_period: 5s
interval: 5s
timeout: 10s
retries: 20
source_only:
build:
dockerfile: debug.Dockerfile
volumes:
- ./auth_config.json:/app/auth_config.json
- ./benchmark.sh:/app/benchmark.sh
- ./coverage.sh:/app/coverage.sh
- ./crates:/app/crates
- ./coverage:/app/coverage
test_setup:
build:
dockerfile: debug.Dockerfile
depends_on:
postgres:
condition: service_healthy
postgres_connector:
condition: service_healthy
custom_connector:
condition: service_healthy
volumes:
- ./auth_config.json:/app/auth_config.json
- ./benchmark.sh:/app/benchmark.sh
- ./coverage.sh:/app/coverage.sh
- ./crates:/app/crates
- ./coverage:/app/coverage
volumes:
postgres: