improved dockerfiles and developer setup

This commit is contained in:
Yannic Kilcher
2022-12-17 22:15:01 +01:00
parent edf123e451
commit b45a974287
37 changed files with 78 additions and 55 deletions
@@ -0,0 +1,5 @@
# Backend Development Setup
Run `docker compose up` to start a database. The default settings are already configured to connect to the database at `localhost:5432`.
Then, run the backend using the `run-local.sh` script. This will start the backend server at `http://localhost:8080`.
@@ -2,10 +2,10 @@
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
# switch to backend directory
pushd "$parent_path/../"
pushd "$parent_path/../../app"
export ALLOW_ANY_API_KEY=True
uvicorn app.main:app --reload
uvicorn main:app --reload --port 8080 --host 0.0.0.0
popd
-7
View File
@@ -1,7 +0,0 @@
#!/usr/bin/env bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
pushd $parent_path
docker build ../../backend -f ../backend.dockerfile -t laion-ai/ocgpt-backend
popd
-5
View File
@@ -1,5 +0,0 @@
#!/bin/bash
# This script launches a ocgpt-backend docker container stand-alone.
docker run -it --rm -p 127.0.0.1:8000:80/tcp --env POSTGRES_SERVER=host.docker.internal:5432 --env ALLOW_ANY_API_KEY=True --add-host host.docker.internal:host-gateway laion-ai/ocgpt-backend
@@ -0,0 +1,5 @@
# Frontend Development Setup
Run `docker compose up --build` to start a database and the backend server.
Then, point your frontend at `http://localhost:8080` to start developing. During development, any API key will be accepted.
@@ -0,0 +1,26 @@
version: "3.7"
services:
db:
extends:
file: ../backend-development/docker-compose.yaml
service: db
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 2s
timeout: 2s
retries: 10
adminer:
extends:
file: ../backend-development/docker-compose.yaml
service: adminer
backend:
build: ../../.
environment:
- POSTGRES_HOST=db
- ALLOW_ANY_API_KEY=True
depends_on:
db:
condition: service_healthy
ports:
- "8080:8080"