From abdaf251f4933a60d2c2c9b78d26bb2a5d61a482 Mon Sep 17 00:00:00 2001 From: Erik Harding Date: Mon, 25 Nov 2024 13:27:20 +0200 Subject: [PATCH] Update dockerfile --- Dockerfile | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index b54ec22..e03654f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,14 @@ -# Use the official Python 3.8 slim image as the base image -FROM python:3.11-slim +FROM ghcr.io/praekeltfoundation/python-base-nw:3.11-bullseye as build -# Set the working directory within the container -WORKDIR /api-flask +RUN pip install poetry==1.8.4 +COPY . ./ +RUN poetry config virtualenvs.in-project true \ + && poetry install --no-dev --no-interaction --no-ansi -# Copy the necessary files and directories into the container -COPY src /api-flask/ -COPY src/data/ /api-flask/data/ +FROM ghcr.io/praekeltfoundation/python-base-nw:3.11-bullseye +COPY --from=build .venv/ .venv/ +COPY src src/ -# Upgrade pip and install Python dependencies -RUN pip3 install --upgrade pip && pip install --no-cache-dir -r requirements.txt - -# Expose port 5000 for the Flask application EXPOSE 5000 -# Define the command to run the Flask application using Gunicorn CMD ["gunicorn", "application:app", "-b", "0.0.0.0:5000", "-w", "4"]