fix(docker): simplify Dockerfile

This commit is contained in:
Aleksandr Tcitlionok
2024-12-05 02:48:45 +00:00
parent 24bb773a70
commit e2076c1b54

View File

@@ -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"]