Created
February 25, 2024 15:07
-
-
Save fsndzomga/cbe5521736a6ffadf0fdb737f80ecf2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use Ubuntu 20.04 LTS as a base image | |
FROM ubuntu:20.04 | |
# Prevent apt from asking questions when installing packages | |
ARG DEBIAN_FRONTEND=noninteractive | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install PostgreSQL, Python, Tesseract-OCR, and other necessary packages in one RUN command | |
RUN apt-get update && apt-get install -y \ | |
postgresql postgresql-contrib \ | |
python3 python3-pip python3-dev \ | |
gcc libpq-dev \ | |
poppler-utils \ | |
tesseract-ocr \ | |
libtesseract-dev \ | |
git \ | |
curl \ | |
&& sed -i 's/local all postgres peer/local all postgres trust/' /etc/postgresql/12/main/pg_hba.conf \ | |
&& sed -i 's/local all all peer/local all all trust/' /etc/postgresql/12/main/pg_hba.conf \ | |
&& echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/12/main/pg_hba.conf \ | |
&& echo "listen_addresses='*'" >> /etc/postgresql/12/main/postgresql.conf \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& pip3 install --no-cache-dir fastapi uvicorn sqlalchemy psycopg2-binary python-dotenv sqlalchemy-utils pgvector pydantic PyPDF2 pytesseract Pillow PyMuPDF nltk openai python-multipart | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Expose the port your app runs on | |
EXPOSE 80 | |
# Automatically start PostgreSQL and keep the container running | |
CMD service postgresql start && tail -f /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment