summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-05-03 11:28:08 +0200
committerGitHub <noreply@github.com>2023-05-03 11:28:08 +0200
commit53b6cf45c699c5e221bb9add7a40ba4e62800220 (patch)
tree9ead24a57b3b87400dc48488f01696318f3f2f2d
parentUpdate README.md (diff)
parentDockerfile optimization (diff)
downloadgpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.tar
gpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.tar.gz
gpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.tar.bz2
gpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.tar.lz
gpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.tar.xz
gpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.tar.zst
gpt4free-53b6cf45c699c5e221bb9add7a40ba4e62800220.zip
-rw-r--r--.dockerignore9
-rw-r--r--Dockerfile27
2 files changed, 28 insertions, 8 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..db8cd761
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,9 @@
+# Development
+.dockerignore
+.git
+.gitignore
+.github
+.idea
+
+# Application
+venv/
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