From c2dfc15fc2133aad818475c769d65f5d8abd92b8 Mon Sep 17 00:00:00 2001 From: TheBoatyMcBoatFace Date: Thu, 12 Oct 2023 14:54:53 -0400 Subject: [PATCH] Fixed Dockerfile Signed-off-by: TheBoatyMcBoatFace --- Dockerfile | 44 ++++++++++++++++---------------------------- requirements.txt | 13 ------------- 2 files changed, 16 insertions(+), 41 deletions(-) delete mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index a1cc79d..00045a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,22 @@ -# Use an official Python runtime as a parent image -# Use bullseye with Python pre-installed -FROM python:3.9-bullseye +# Use an official Python image +FROM python:3.11-slim -# Set the working directory to /app -WORKDIR /app - -# Copy all the things... -ADD . /app/ - -# Add essential packages and psycopg2 prerequisites then upgrade pip -RUN apt-get update && apt-get install -y \ - gcc \ - python3-dev \ - libpq-dev \ -&& pip install --upgrade pip +# Install Poetry +RUN pip install --upgrade pip \ + && pip install poetry \ + && poetry config virtualenvs.create false -# Install python packages and remove unnecessary packages -RUN pip install --no-cache-dir -r requirements.txt \ - && apt-get autoremove -y gcc python3-dev \ - && rm -rf /var/lib/apt/lists/* - -# Make Log file -RUN mkdir -p /app/logs +# Create and set working directory +WORKDIR /app +# Copy over the pyproject.toml and poetry.lock file to install dependencies +COPY pyproject.toml poetry.lock* /app/ -# Env Variables -ENV APP_PORT=3000 +# Install runtime dependencies using Poetry +RUN poetry install --no-dev -# Expose APP_PORT of the container to the outside -EXPOSE $APP_PORT +# Copy the rest of the code +COPY . /app/ -# Run the command to start things... -CMD ["python", "app/main.py"] \ No newline at end of file +# Command to run the application +CMD ["python3", "-m", "run"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 643522d..0000000 --- a/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -clickhouse-driver==0.2.6 -greenlet==2.0.2 -markdown-it-py==3.0.0 -mdurl==0.1.2 -psycopg2==2.9.6 -Pygments==2.15.1 -PyMySQL==1.1.0 -python-dotenv==1.0.0 -pytz==2023.3 -rich==13.4.2 -SQLAlchemy==2.0.18 -typing_extensions==4.7.1 -tzlocal==5.0.1