| # Copyright 2021 The Go Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style |
| # license that can be found in the LICENSE file. |
| version: '3' |
| services: |
| chrome: |
| image: browserless/chrome:1.46-chrome-stable |
| depends_on: |
| - frontend |
| ports: |
| - 3000:3000 |
| environment: |
| - CONNECTION_TIMEOUT=120000 |
| frontend: |
| build: |
| context: ../../ |
| dockerfile: e2e/docker/Dockerfile.frontend |
| command: ./frontend -host=0.0.0.0:8080 |
| depends_on: |
| - migrate |
| environment: |
| - GO_DISCOVERY_DATABASE_USER=postgres |
| - GO_DISCOVERY_DATABASE_PASSWORD=postgres |
| - GO_DISCOVERY_DATABASE_HOST=db |
| - GO_DISCOVERY_DATABASE_NAME=discovery_e2e_test |
| - PORT=8080 |
| image: pkgsite_frontend |
| ports: |
| - 8080:8080 |
| migrate: |
| depends_on: |
| - wait_for_db |
| image: migrate/migrate:v4.14.1 |
| volumes: |
| - ../../migrations:/pkgsite/migrations |
| command: |
| [ |
| '-path', |
| '/pkgsite/migrations', |
| '-database', |
| 'postgres://postgres:postgres@db:5432/discovery_e2e_test?sslmode=disable', |
| 'up', |
| ] |
| # wait_for_db is used to delay migrations until the database is ready for connections. |
| wait_for_db: |
| image: ubuntu:14.04 |
| depends_on: |
| - db |
| command: > |
| /bin/bash -c " |
| while ! nc -z db 5432; |
| do |
| echo sleeping; |
| sleep 1; |
| done; |
| echo connected!; |
| " |
| db: |
| image: postgres:11.12 |
| environment: |
| - POSTGRES_PASSWORD=postgres |
| - POSTGRES_USER=postgres |
| - POSTGRES_DB=discovery_e2e_test |
| ports: |
| - 5428:5432 |