From e2076c1b5441a59e46e3f9d6a2e300fe68d9225d Mon Sep 17 00:00:00 2001 From: Aleksandr Tcitlionok <803797+terghalin@users.noreply.github.com> Date: Thu, 5 Dec 2024 02:48:45 +0000 Subject: [PATCH] fix(docker): simplify Dockerfile --- Dockerfile | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9c5a357..9a88d9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,25 @@ -FROM debian:bookworm-slim +FROM python:3.10-slim as base -RUN apt-get update && apt-get install -y \ - curl \ +WORKDIR /app +ENV PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libssl-dev \ zlib1g-dev \ libbz2-dev \ libreadline-dev \ libsqlite3-dev \ - wget \ - git \ - libncurses5-dev \ libffi-dev \ liblzma-dev \ - && rm -rf /var/lib/apt/lists/* - -# Install pyenv -RUN curl https://pyenv.run | bash -ENV PYENV_ROOT="/root/.pyenv" -ENV PATH="$PYENV_ROOT/bin:$PATH" -RUN pyenv install 3.10.12 && pyenv global 3.10.12 -RUN python --version - -WORKDIR /app -COPY . /app + curl \ + git \ + && apt-get clean && rm -rf /var/lib/apt/lists/* +COPY app/requirements.txt /app/ RUN pip install --no-cache-dir -r requirements.txt +COPY app/ /app/ EXPOSE 8000 - CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]