From a4d4552fdcb2a6f485cc8830989af8902bec9323 Mon Sep 17 00:00:00 2001 From: quambene Date: Wed, 3 Apr 2024 02:13:00 +0200 Subject: [PATCH] Add docker compose yaml --- .gitignore | 6 +++--- README.md | 36 +++++++++++++++++++----------------- docker-compose.yaml | 15 +++++++++++++++ 3 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 docker-compose.yaml diff --git a/.gitignore b/.gitignore index 34a2268..29149cb 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ rust-toolchain # Config files **/*.yaml +# Allow docker-compose.yaml +!docker-compose.yaml + # Data **/*.csv **/*.jpg @@ -37,6 +40,3 @@ rust-toolchain # VS Code **/.vscode - -# Docker -docker-compose.yaml diff --git a/README.md b/README.md index 76e77b8..14c32af 100644 --- a/README.md +++ b/README.md @@ -445,23 +445,25 @@ Sendgrid | equals monthly limit ## Testing -Some integration tests require a locally running database, and an AWS SES account. -Specify the following environment variables: - -- SMTP - - `SMTP_SERVER` - - `SMTP_USERNAME` - - `SMTP_PASSWORD` -- AWS SES - - `AWS_ACCESS_KEY_ID` - - `AWS_SECRET_ACCESS_KEY` - - `AWS_REGION` -- Postgres - - `DB_HOST` - - `DB_PORT` - - `DB_USER` - - `DB_PASSWORD` - - `DB_NAME` +Some integration tests require a locally running database, and an AWS SES +account: + +1. Specify the following environment variables: + - SMTP + - `SMTP_SERVER` + - `SMTP_USERNAME` + - `SMTP_PASSWORD` + - AWS SES + - `AWS_ACCESS_KEY_ID` + - `AWS_SECRET_ACCESS_KEY` + - `AWS_REGION` + - Postgres + - `DB_HOST` + - `DB_PORT` + - `DB_USER` + - `DB_PASSWORD` + - `DB_NAME` +2. Set up a temporary postgres db: `docker-compose run --rm --service-ports postgres` ``` bash # Run unit tests and integration tests diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..deb4c2f --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: '3' +services: + postgres: + env_file: + - .env + volumes: + - ./test_data:/docker-entrypoint-initdb.d + image: postgres:16-alpine + restart: "no" + ports: + - "${DB_PORT}:5432" + environment: + POSTGRES_USER: "${DB_USER}" + POSTGRES_PASSWORD: "${DB_PASSWORD}" + POSTGRES_DB: "${DB_NAME}"