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..077fcc2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +services: + slackbot-ai: + container_name: slack-bot-ai + image: slackbot-ai:latest + build: . + ports: + - "7999:7999" + 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..19624e9 --- /dev/null +++ b/dockerfile @@ -0,0 +1,29 @@ +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.4.0 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/ + +ENTRYPOINT ["uvicorn", "project.api:app", "--host", "0.0.0.0", "--port", "7999", "--reload"] \ No newline at end of file