diff --git a/Dockerfile b/Dockerfile index cf989b06..06d32a36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM python:3.10-slim AS build +ARG PYTHON_VERSION=3.12 + +FROM python:$PYTHON_VERSION-slim AS build ENV PYTHONUNBUFFERED=1 WORKDIR /code RUN apt-get update \ - && apt-get install -y --no-install-recommends curl unzip gcc python3-dev \ + && apt-get install -y --no-install-recommends build-essential curl unzip gcc python3-dev libpq-dev \ && curl -L https://github.com/Gozargah/Marzban-scripts/raw/master/install_latest_xray.sh | bash \ && rm -rf /var/lib/apt/lists/* @@ -13,14 +15,16 @@ COPY ./requirements.txt /code/ RUN python3 -m pip install --upgrade pip setuptools \ && pip install --no-cache-dir --upgrade -r /code/requirements.txt -FROM python:3.10-slim +FROM python:$PYTHON_VERSION-slim +ENV PYTHON_LIB_PATH=/usr/local/lib/python${PYTHON_VERSION%.*}/site-packages WORKDIR /code -RUN rm -rf /usr/local/lib/python3.10/site-packages/* +RUN rm -rf $PYTHON_LIB_PATH/* -COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages +COPY --from=build $PYTHON_LIB_PATH $PYTHON_LIB_PATH COPY --from=build /usr/local/bin /usr/local/bin +COPY --from=build /usr/local/share/xray /usr/local/share/xray COPY . /code