Skip to content

Docker-Compose Validation #43

Docker-Compose Validation

Docker-Compose Validation #43

name: Docker-Compose Validation
on:
push:
branches:
- '*'
schedule:
- cron: '30 5 * * 2,4'
jobs:
test-docker:
name: Docker Image Build
strategy:
matrix:
node: ['14', '16', '18']
implementation: ['restify', 'plain', 'express', 'koa', 'fastify']
runs-on: 'ubuntu-20.04'
steps:
- name: Checkout the commit triggering this job
uses: actions/checkout@v4
# Commands you use with run start in new containers with configuration defined by that of
# the service, including volumes, links, and other details, except:
# 1) The command passed as an argument overrides the defined command.
# 2) None of the ports specified in the service configuration are bound.
#
# - https://docs.docker.com/compose/reference/run/, https://github.com/docker/compose/pull/4954
- name: Build and bring up the stack described in docker-compose.yml
run: |
docker-compose build
docker-compose up -d database
docker-compose run -d --service-ports backend npm run start:${{ matrix.implementation }}
- name: Setup Node with npm cache
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies from package.json
run: npm install
- name: Run tests against live Postgres and Node server
run: npm --test_live_pg_server=true --test_live_node_server=true run test:${{ matrix.implementation}}
- name: Bring down stack
run: docker-compose down