blob: b367ee77f0e8c44f37da0e80533b26f3b7e076ef [file] [log] [blame]
# 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:
allbash:
# Allocate a pseudo-tty, which sets the TERM
# environment variable to xterm.
# See
# https://docs.docker.com/engine/reference/run/#env-environment-variables and
# https://www.gnu.org/software/gettext/manual/html_node/The-TERM-variable.html.
# This is necessary because devtools/lib.sh uses tput.
tty:
true
# allbash depends only on db, since the Go tests will set up its own
# test databases.
depends_on:
- db
# This should match the version we are using on AppEngine.
image: golang:1.15.5
environment:
- GO_DISCOVERY_DATABASE_HOST=db
- GO_DISCOVERY_DATABASE_NAME=${GO_DISCOVERY_DATABASE_NAME:-"discovery-db"}
- GO_DISCOVERY_DATABASE_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
- GO_DISCOVERY_DATABASE_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
- GO_DISCOVERY_TESTDB=${GO_DISCOVERY_TESTDB:-true}
- GOMODCACHE=/gomodcache
# TERM is set to xterm-256color for use by devtools/lib.sh.
- TERM=xterm-256color
- WAITFORIT_TIMEOUT=300
entrypoint: "./third_party/wait-for-it/wait-for-it.sh db:5432 -- ./all.bash"
volumes:
- ../../:/pkgsite
- $GOPATH/pkg/mod:/gomodcache
working_dir: /pkgsite
e2e:
image: node:14.17.0
depends_on:
- chrome
- frontend
environment:
# CI is used for cleaner log output from jest and npm install
- CI=true
- GO_DISCOVERY_E2E_BASE_URL=http://frontend:8080
- GO_DISCOVERY_E2E_CHROME_URL=ws://chrome:3000
- WAITFORIT_TIMEOUT=300
entrypoint: ./third_party/wait-for-it/wait-for-it.sh frontend:8080 -- npx jest
command: e2e
volumes:
- ../../:/pkgsite
working_dir: /pkgsite
chrome:
image: browserless/chrome:1.46-chrome-stable
ports:
- 3000:3000
environment:
- CONNECTION_TIMEOUT=120000
frontend:
# This should match the version we are using on AppEngine.
image: golang:1.15.5
depends_on:
- migrate
command: bash -c "
./third_party/wait-for-it/wait-for-it.sh db:5432 --
go run ./cmd/frontend -host=0.0.0.0:8080"
environment:
- GO_DISCOVERY_DATABASE_HOST=db
- GO_DISCOVERY_DATABASE_NAME=${GO_DISCOVERY_DATABASE_NAME:-"discovery-db"}
- GO_DISCOVERY_DATABASE_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
- GO_DISCOVERY_DATABASE_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
- GO_DISCOVERY_LOG_LEVEL=${GO_DISCOVERY_LOG_LEVEL:-info}
- GOMODCACHE=/gomodcache
- WAITFORIT_TIMEOUT=300
- PORT=8080
ports:
- 8080:8080
volumes:
- ../../:/pkgsite
- $GOPATH/pkg/mod:/gomodcache
working_dir: /pkgsite
seeddb:
# This should match the version we are using on AppEngine.
image: golang:1.15.5
depends_on:
- migrate
# Note: technically we should check that migrations have completed before
# running seeddb, but in general, migrations will have completed by the
# time seeddb runs. If this ends up being flaky, we should add a check here.
command: bash -c "
./third_party/wait-for-it/wait-for-it.sh db:5432 --
go run ./devtools/cmd/seeddb/seeddb/main.go"
environment:
- GO_DISCOVERY_DATABASE_HOST=db
- GO_DISCOVERY_DATABASE_NAME=${GO_DISCOVERY_DATABASE_NAME:-"discovery-db"}
- GO_DISCOVERY_DATABASE_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
- GO_DISCOVERY_DATABASE_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
- GO_DISCOVERY_LOG_LEVEL=${GO_DISCOVERY_LOG_LEVEL:-info}
- GOMODCACHE=/gomodcache
- WAITFORIT_TIMEOUT=300
- PORT=8080
ports:
- 8080:8080
volumes:
- ../../:/pkgsite
- $GOPATH/pkg/mod:/gomodcache
working_dir: /pkgsite
migrate:
depends_on:
- db
image: migrate/migrate:v4.14.1
entrypoint: ""
command: sh -c "
apk add --no-cache bash &&
./third_party/wait-for-it/wait-for-it.sh db:5432 --
migrate -path /pkgsite/migrations
-database postgres://postgres:postgres@db:5432/${GO_DISCOVERY_DATABASE_NAME:-'discovery-db'}?sslmode=disable up"
environment:
- WAITFORIT_TIMEOUT=300
volumes:
- ../../:/pkgsite
working_dir: /pkgsite
db:
image: postgres:11.12
environment:
- LANG=C
- POSTGRES_DB=${GO_DISCOVERY_DATABASE_NAME:-"discovery-db"}
- POSTGRES_USER=${GO_DISCOVERY_DATABASE_USER:-postgres}
- POSTGRES_PASSWORD=${GO_DISCOVERY_DATABASE_PASSWORD:-postgres}
ports:
- ${GO_DISCOVERY_DATABASE_PORT:-5432}:5432
nodejs:
image: node:14.17.0
environment:
# Use the values set on the host machine environment.
- CI
- GO_DISCOVERY_E2E_BASE_URL
- GO_DISCOVERY_E2E_AUTHORIZATION
- GO_DISCOVERY_E2E_QUOTA_BYPASS
- PUPPETEER_SKIP_CHROMIUM_DOWNLOAD
volumes:
- ../../:/pkgsite
working_dir: /pkgsite