From 527a66c2af84cda495602ea77dda205e1915c544 Mon Sep 17 00:00:00 2001 From: VitalyArt Date: Tue, 2 May 2023 23:24:48 +0500 Subject: Dockerfile optimization --- Dockerfile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 5ed902fb..45f111c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,29 @@ -FROM python:3.10 +FROM python:3.11 as builder + +WORKDIR /usr/app +ENV PATH="/usr/app/venv/bin:$PATH" RUN apt-get update && apt-get install -y git +RUN mkdir -p /usr/app +RUN python -m venv ./venv + +COPY requirements.txt . -RUN mkdir -p /usr/src/gpt4free -WORKDIR /usr/src/gpt4free +RUN pip install -r requirements.txt # RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ # RUN pip config set global.trusted-host mirrors.aliyun.com -COPY requirements.txt /usr/src/gpt4free/ -RUN pip install --no-cache-dir -r requirements.txt -COPY . /usr/src/gpt4free -RUN cp gui/streamlit_app.py . +FROM python:3.11-alpine -EXPOSE 8501 +WORKDIR /usr/app +ENV PATH="/usr/app/venv/bin:$PATH" + +COPY --from=builder /usr/app/venv ./venv +COPY . . + +RUN cp ./gui/streamlit_app.py . CMD ["streamlit", "run", "streamlit_app.py"] + +EXPOSE 8501 -- cgit v1.2.3 From 2ed8ddaf274be2c24f412fd59eabd8dceab3d944 Mon Sep 17 00:00:00 2001 From: kainstan Date: Thu, 4 May 2023 15:09:10 +0800 Subject: Fix numpy c dependency issue --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 45f111c6..297ebbbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.11 as builder WORKDIR /usr/app ENV PATH="/usr/app/venv/bin:$PATH" -RUN apt-get update && apt-get install -y git +#RUN apt-get update && apt-get install -y git RUN mkdir -p /usr/app RUN python -m venv ./venv @@ -14,7 +14,7 @@ RUN pip install -r requirements.txt # RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ # RUN pip config set global.trusted-host mirrors.aliyun.com -FROM python:3.11-alpine +FROM python:3.11 WORKDIR /usr/app ENV PATH="/usr/app/venv/bin:$PATH" -- cgit v1.2.3