Skip to content

Correcting service loading of database service #48

Correcting service loading of database service

Correcting service loading of database service #48

Workflow file for this run

name: Build CI
on:
push:
branches:
- main
jobs:
build_webapp:
runs-on: ubuntu-latest
environment: staging
env:
SECRET_KEY: ${{secrets.SECRET_KEY}}
JWT_SECRET: ${{secrets.JWT_SECRET}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
ENV: 'production'
NODE_ENV: 'production'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
services:
database:
image: postgres
env:
POSTGRES_USER: ${{secrets.POSTGRES_USER}}
POSTGRES_PASSWORD: ${{secrets.POSTGRES_PASSWORD}}
POSTGRES_DB: ${{secrets.POSTGRES_DB}}
steps:
- name: Cloning repository
uses: actions/checkout@v2
- run: echo "SECRET_KEY=\"${SECRET_KEY}\"\n" >> .env
- run: echo "JWT_SECRET=\"${JWT_SECRET}\"\n" >> .env
- run: echo "GH_TOKEN=\"${GH_TOKEN}\"\n" >> .env
- run: echo "POSTGRES_USER=\"${POSTGRES_USER}\"\n" >> .env
- run: echo "POSTGRES_PASSWORD=\"${POSTGRES_PASSWORD}\"\n" >> .env
- run: echo "POSTGRES_DB=\"${POSTGRES_PASSWORD}\"\n" >> .env
- run: echo "DATABASE_URL=\"${DATABASE_URL}\"\n" >> .env
- run: echo "REDIS_HOST=\"${REDIS_HOST}\"\n" >> .env
- run: echo "REDIS_PORT=\"${REDIS_PORT}\"\n" >> .env
- run: echo "YUBIKEY_CLIENT_ID=\"${YUBIKEY_CLIENT_ID}\"\n" >> .env
- run: echo "YUBIKEY_CLIENT_SECRET=\"${YUBIKEY_CLIENT_SECRET}\"\n" >> .env
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v1
- name: Log into container registery
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT_BUILD }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: ./
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
build-args: |
DATABASE_URL=postgresql://${{secrets.POSTGRES_USER}}:${{secrets.POSTGRES_PASSWORD}}@database:5432/${{secrets.POSTGRES_DB}}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}