Skip to content

Commit

Permalink
docker-compose: add example test file
Browse files Browse the repository at this point in the history
Add example docker-compose file and also use it as a test during the build
of each commit to make sure pg_back supports all major revisions of
Postgres.
  • Loading branch information
kruton authored and orgrim committed Sep 9, 2023
1 parent cddabc2 commit 3866fde
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ env:
IMAGE_NAME: pg_back

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
pg_version: [12, 13, 14, 15]

steps:
- name: Checkout
uses: actions/checkout@v3.5.3

- name: Test Docker container
uses: adambirds/docker-compose-action@v1.3.0
env:
PG_VERSION: ${{ matrix.pg_version }}
with:
compose-file: ./docker/compose.test.yml
up-flags: --abort-on-container-exit --exit-code-from pg_back
down-flags: --volumes

buildx:
runs-on: ubuntu-latest
permissions:
Expand Down
21 changes: 21 additions & 0 deletions docker/compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:

postgres:
image: postgres:${PG_VERSION}
environment:
- PG_VERSION=latest
- POSTGRES_PASSWORD=secret
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

pg_back:
build: ..
environment:
- PGPASSWORD=secret
command: -h postgres -p 5432 -U postgres
depends_on:
postgres:
condition: service_healthy

0 comments on commit 3866fde

Please sign in to comment.