fix action bg dump version #287
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
redis: | |
image: redis | |
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: | |
- 6379:6379 | |
postgres: | |
# Use a Postgres image that has wal2json installed | |
image: debezium/postgres:11 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup node and cache | |
uses: ./.github/actions/node-and-cache | |
- name: Install pg_dump | |
uses: ./.github/actions/install-pg-dump | |
- name: Setup database | |
run: | | |
cp .env.ci .env | |
yarn install | |
CONFIRM_DROP=1 yarn setup | |
env: | |
CI: true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build server | |
uses: docker/build-push-action@v2 | |
with: | |
file: ./docker/dockerfiles/Dockerfile.prod | |
load: true | |
push: false | |
build-args: ROOT_URL=https://ilmo.prodeko.org | |
tags: | | |
ilmo-server | |
${{ secrets.REGISTRY_LOGIN_SERVER }}/ilmo/ilmo-server | |
secrets: | | |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | |
GITHUB_SHA=${{ github.sha }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: server | |
- name: Build worker | |
uses: docker/build-push-action@v2 | |
with: | |
file: ./docker/dockerfiles/Dockerfile.prod | |
load: true | |
push: false | |
build-args: ROOT_URL=https://ilmo.prodeko.org | |
tags: | | |
ilmo-worker | |
${{ secrets.REGISTRY_LOGIN_SERVER }}/ilmo/ilmo-worker | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
target: worker | |
- name: Start server | |
run: | | |
docker run --rm -d --init -p 5678:5678 \ | |
--env-file .env \ | |
-e CI=true \ | |
-e NODE_ENV=production \ | |
-e DATABASE_HOST=172.17.0.1 \ | |
-e REDIS_URL=redis://172.17.0.1:6379 \ | |
--name ilmo-server ilmo-server | |
- name: Start worker | |
run: | | |
docker run --rm -d --init \ | |
--env-file .env \ | |
-e CI=true \ | |
-e NODE_ENV=production \ | |
-e DATABASE_HOST=172.17.0.1 \ | |
-e REDIS_URL=redis://172.17.0.1:6379 \ | |
--name ilmo-worker ilmo-worker | |
- name: Test docker | |
run: node .github/workflows/test-docker.js | |
- name: Tear down docker | |
run: docker kill ilmo-server ilmo-worker | |
- name: Docker login to ACR | |
uses: azure/docker-login@v1 | |
with: | |
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Push images to ACR | |
run: | | |
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/ilmo/ilmo-server | |
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/ilmo/ilmo-worker | |
- name: Deploy project | |
uses: ./.github/workflows/deploy |