-
Notifications
You must be signed in to change notification settings - Fork 573
/
Copy pathDockerfile
35 lines (23 loc) · 1.04 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 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/*
COPY ./requirements.txt /code/
RUN python3 -m pip install --upgrade pip setuptools \
&& pip install --no-cache-dir --upgrade -r /code/requirements.txt
FROM python:$PYTHON_VERSION-slim
ENV PYTHON_LIB_PATH=/usr/local/lib/python${PYTHON_VERSION%.*}/site-packages
WORKDIR /code
RUN rm -rf $PYTHON_LIB_PATH/*
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
RUN ln -s /code/marzban-cli.py /usr/bin/marzban-cli \
&& chmod +x /usr/bin/marzban-cli \
&& marzban-cli completion install --shell bash
CMD ["bash", "-c", "alembic upgrade head; python main.py"]