Files
Marzban/Dockerfile

36 lines
1.0 KiB
Docker
Raw Normal View History

ARG PYTHON_VERSION=3.12
FROM python:$PYTHON_VERSION-slim AS build
2022-12-09 04:27:46 +03:30
2024-10-21 22:07:46 +03:00
ENV PYTHONUNBUFFERED=1
2022-12-09 04:27:46 +03:30
WORKDIR /code
2023-01-11 23:49:22 +03:30
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential curl unzip gcc python3-dev libpq-dev \
2024-10-15 11:36:39 +03:00
&& curl -L https://github.com/Gozargah/Marzban-scripts/raw/master/install_latest_xray.sh | bash \
2023-01-10 03:37:16 +03:30
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements.txt /code/
2024-10-15 11:36:39 +03:00
RUN python3 -m pip install --upgrade pip setuptools \
&& pip install --no-cache-dir --upgrade -r /code/requirements.txt
2022-12-09 04:27:46 +03:30
FROM python:$PYTHON_VERSION-slim
ENV PYTHON_LIB_PATH=/usr/local/lib/python${PYTHON_VERSION%.*}/site-packages
2024-10-15 11:36:39 +03:00
WORKDIR /code
RUN rm -rf $PYTHON_LIB_PATH/*
2024-10-15 11:36:39 +03:00
COPY --from=build $PYTHON_LIB_PATH $PYTHON_LIB_PATH
2024-10-15 11:36:39 +03:00
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /usr/local/share/xray /usr/local/share/xray
2024-10-15 11:36:39 +03:00
COPY . /code
2023-01-11 23:49:22 +03:30
RUN ln -s /code/marzban-cli.py /usr/bin/marzban-cli \
&& chmod +x /usr/bin/marzban-cli \
&& marzban-cli completion install --shell bash
2024-10-15 11:36:39 +03:00
CMD ["bash", "-c", "alembic upgrade head; python main.py"]