diff --git a/backend/backend.dockerfile b/backend/backend.dockerfile new file mode 100644 index 00000000..49f295d2 --- /dev/null +++ b/backend/backend.dockerfile @@ -0,0 +1,14 @@ +FROM python:3.9 + +WORKDIR /code + +COPY ./requirements.txt /code/requirements.txt + +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt + +COPY ./app /code/app + +COPY ./app /app +ENV PYTHONPATH=/app + +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] diff --git a/backend/database.dockerfile b/backend/database.dockerfile new file mode 100644 index 00000000..69ce4e61 --- /dev/null +++ b/backend/database.dockerfile @@ -0,0 +1,3 @@ +FROM postgres:15 + +COPY ./scripts/create-db.sh /docker-entrypoint-initdb.d/ diff --git a/backend/scripts/create-db.sh b/backend/scripts/create-db.sh new file mode 100755 index 00000000..409377e6 --- /dev/null +++ b/backend/scripts/create-db.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE DATABASE ocgpt_backend; +EOSQL