From bc961af1ba3d280b27771fa35fb81462440ec86d Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 10 Jul 2024 19:10:39 +0600 Subject: [PATCH 1/5] add docker --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..be6e731da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Use an official Python runtime as a base image +FROM python:3.9-slim AS builder + +# Set the working directory inside the container +WORKDIR /app + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + pkg-config \ + libicu-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt /app/ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /app + +FROM python:3.9-slim +WORKDIR /app + +# Copy installed dependencies from the builder stage +COPY --from=builder /usr/local/lib/python3.9 /usr/local/lib/python3.9 +COPY --from=builder /usr/local/bin /usr/local/bin + +# Copy the project files from the builder stage +COPY --from=builder /app /app + +# Set the PYTHONPATH environment variable to include the src directory +ENV PYTHONPATH=/app/src + +# Set the entry point to the main CLI script +ENTRYPOINT ["python", "src/scribe_data/cli/main.py"] From 8d14e76c7dd05cd3a28800fbfd25a506e064d921 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 21 Aug 2024 06:48:36 +0600 Subject: [PATCH 2/5] add ignore file --- .dockerignore | 7 +++++++ Dockerfile | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..3185a9b9b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +__pycache__/ +*.pyc +*.pyo +*.pyd +.venv/ +venv/ +.git/ diff --git a/Dockerfile b/Dockerfile index be6e731da..5c4c781c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,9 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/ -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --upgrade pip && \ + pip install --no-cache-dir --default-timeout=300 -r requirements.txt + COPY . /app From 271db79a7e9c64f653fc84c7aa1f1973c9e184db Mon Sep 17 00:00:00 2001 From: wkyoshida Date: Sat, 21 Sep 2024 23:24:31 -0300 Subject: [PATCH 3/5] refac(docker): Update `Dockerfile` to remove multi-stage --- Dockerfile | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5c4c781c0..0c9c508b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use an official Python runtime as a base image -FROM python:3.9-slim AS builder +FROM python:slim # Set the working directory inside the container WORKDIR /app @@ -12,22 +12,10 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/ -RUN pip install --upgrade pip && \ - pip install --no-cache-dir --default-timeout=300 -r requirements.txt - +RUN pip install --no-cache-dir -r requirements.txt COPY . /app -FROM python:3.9-slim -WORKDIR /app - -# Copy installed dependencies from the builder stage -COPY --from=builder /usr/local/lib/python3.9 /usr/local/lib/python3.9 -COPY --from=builder /usr/local/bin /usr/local/bin - -# Copy the project files from the builder stage -COPY --from=builder /app /app - # Set the PYTHONPATH environment variable to include the src directory ENV PYTHONPATH=/app/src From cb29d7b9fb84a7756e72e05421369f71007c31cd Mon Sep 17 00:00:00 2001 From: wkyoshida Date: Mon, 23 Sep 2024 23:03:29 -0300 Subject: [PATCH 4/5] chore(requirements): Update to remove `tensorflow` --- docs/source/conf.py | 1 - requirements.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 742ed84d3..2d8f470b5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -66,7 +66,6 @@ "sentencepiece", "SPARQLWrapper", "tabulate", - "tensorflow", "torch", "tqdm", "transformers", diff --git a/requirements.txt b/requirements.txt index 69b943b36..e4d38be97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,6 @@ sentencepiece>=0.1.95 SPARQLWrapper>=2.0.0 sphinx-rtd-theme>=2.0.0 tabulate>=0.8.9 -tensorflow>=2.0 torch>=2.2.1 tqdm==4.66.4 transformers>=4.12 From 669412f385a7d679c1cad2c5e17842c438bb095a Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Tue, 19 Nov 2024 03:10:00 +0100 Subject: [PATCH 5/5] Fix comment formatting for Docker file --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c9c508b9..55f146999 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -# Use an official Python runtime as a base image +# Use an official Python runtime as a base image. FROM python:slim -# Set the working directory inside the container +# Set the working directory inside the container. WORKDIR /app -# Install system dependencies +# Install system dependencies. RUN apt-get update && apt-get install -y \ build-essential \ pkg-config \ @@ -16,8 +16,8 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . /app -# Set the PYTHONPATH environment variable to include the src directory +# Set the PYTHONPATH environment variable to include the src directory. ENV PYTHONPATH=/app/src -# Set the entry point to the main CLI script +# Set the entry point to the main CLI script. ENTRYPOINT ["python", "src/scribe_data/cli/main.py"]