test-flask-app / Dockerfile
frasan's picture
f
dc12774
raw
history blame
1.13 kB
# Use the official Python image as base image
FROM python:3.9-slim
RUN apt-get update && apt-get install -y \
python3.10 python3-pip \
tesseract-ocr \
libtesseract-dev \
libgl1-mesa-glx \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y libgl1-mesa-glx
# Copy the dependencies file to the working directory
COPY requirements.txt .
# Install dependencies
RUN pip install --trusted-host pypi.python.org -r requirements.txt
# Copy the content of the local src directory to the working directory
COPY . .
# Create a user to run the application
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory in the user's home directory
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
# Expose the port number on which the Flask app will run
EXPOSE 8080
# Define environment variable
ENV NAME World
# Command to run on container start
CMD [ "gunicorn", "-b", "0.0.0.0:8080", "librarymed.app_librarymed:app" ]