Skip to content

Commit

Permalink
Add database docker build command.
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed Nov 9, 2023
1 parent f93ae9e commit bc3f8d1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@ on:
- '*'

jobs:
database:
name: Build backend database
runs-on: ubuntu-latest
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost:5555/postgres"
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Start database
working-directory: backend
run: |
docker run -d \
--name my-db \
-p 5555:5432 \
-e PGDATA=/data \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=postgres \
postgres:16
- name: Init DB with prisma
working-directory: backend
run: npx prisma migrate dev --name init
- name: Seed DB with data
working-directory: backend
run: npm run seed
- name: Commit current state of the container
working-directory: backend
run: docker commit my-db daemontus/bbm-database:latest
- name: Push image
working-directory: backend
run: docker push daemontus/bbm-database

backend:
name: Build backend image
runs-on: ubuntu-latest
Expand Down

0 comments on commit bc3f8d1

Please sign in to comment.