diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3997bea --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +*.db \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7be13ca --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +docker_build: + @docker compose up --no-start slackbot-ai + +docker_start_all: docker_build + @docker compose start slackbot-ai + +docker_stop_all: + @docker compose stop \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0ff25c3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + slackbot-ai: + container_name: slack-bot-ai + image: slackbot-ai:latest + build: . + ports: + - "${PORT:-7999}:${PORT:-7999}" + - "${DEBUG_PORT:-3000}:${DEBUG_PORT:-3000}" + env_file: .env + tty: true + stdin_open: true + volumes: + - type: bind + source: . + target: /app/ diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..97bd491 --- /dev/null +++ b/dockerfile @@ -0,0 +1,31 @@ +FROM python:3.10-slim AS base + +ENV LANG C.UTF-8 +ENV PYTHONUNBUFFERED 1 + +RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + tzdata \ + git \ + libatlas-base-dev\ + && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + pip install --no-cache-dir poetry==1.8.3 setuptools && poetry config virtualenvs.create false + + +RUN pip install --upgrade pip && pip install --no-cache-dir poetry gunicorn uvicorn && poetry config virtualenvs.create false + + +FROM base AS install + +WORKDIR /app +COPY pyproject.toml poetry.lock /app/ +RUN poetry install --no-dev + +FROM install AS runtime +COPY . /app/ + +ENV PORT=7999 + +ENTRYPOINT ["sh", "-c", "uvicorn project.api:app --host 0.0.0.0 --port $PORT --reload"]