Skip to content

Commit

Permalink
Dockerfile optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalyArt committed May 2, 2023
1 parent 871e397 commit 527a66c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Development
.dockerignore
.git
.gitignore
.github
.idea

# Application
venv/
27 changes: 19 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 527a66c

Please sign in to comment.