From 119b781b727a0a92464d056d7dbaa6d2b1a1634d Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Sun, 3 Aug 2025 01:50:14 -0400 Subject: [PATCH] refactor Dockerfile to use requirements.txt for Python package installation --- Dockerfile | 20 ++++---------------- requirements.txt | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index 8b804b5..3adc217 100644 --- a/Dockerfile +++ b/Dockerfile @@ -243,22 +243,10 @@ RUN apt update && \ groupadd docker -# Install Python packages -RUN pip3 install --no-cache-dir \ - autopep8 \ - cachelib \ - "check50<4" \ - cli50 \ - compare50 \ - cs50==9.4.0 \ - Flask \ - Flask-Session \ - help50 \ - pytest \ - render50 \ - setuptools \ - "style50>2.10.0" \ - "submit50<4" +# Copy requirements file and install Python packages +COPY requirements.txt /tmp/requirements.txt +RUN pip3 install --no-cache-dir --requirement /tmp/requirements.txt && \ + rm /tmp/requirements.txt # Copy files to image diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..17e153a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +autopep8==2.3.2 +cachelib==0.13.0 +check50==3.4.0 +cli50==8.0.1 +compare50==1.2.13 +cs50==9.4.0 +Flask==3.1.1 +Flask-Session==0.8.0 +help50==3.0.5 +pytest==8.4.1 +render50==9.2.10 +setuptools==80.9.0 +style50==2.10.4 +submit50==3.2.1