Spaces:
Runtime error
Runtime error
File size: 2,155 Bytes
c7a353e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# FROM postgres:15
# # Update package list and install Python 3, Pip, and any required packages
# FROM ubuntu:20.04
# # Update package list and install Python 3, Pip, and required packages
# RUN apt-get update && apt-get install -y python3 python3-pip python3-venv
# # Install dependencies for PostgreSQL or Python packages
# RUN apt-get install -y libpq-dev gcc
# # Create and activate a virtual environment
# WORKDIR /app
# RUN python3 -m venv venv
# ENV PATH="/app/venv/bin:$PATH"
# # Copy application files
# COPY . /app
# ENV DEBIAN_FRONTEND=noninteractive
# # Install Python dependencies inside the virtual environment
# RUN pip install --upgrade pip
# RUN pip install -r requirements.txt
# # Install required packages for PostgreSQL
# RUN apt-get update && apt-get install -y \
# postgresql \
# postgresql-contrib \
# && rm -rf /var/lib/apt/lists/*
# # Set environment variables for PostgreSQL
# ENV POSTGRES_USER="admin"
# ENV POSTGRES_PASSWORD="admin"
# ENV POSTGRES_DB="admin"
# # Expose the PostgreSQL port
# EXPOSE 5432
# # Install any necessary dependencies
# # RUN pip install -r requirements.txt
# # Initialize PostgreSQL database and start the service
# # Initialize PostgreSQL database and start the service
# # Set environment variables for database name, username, and password
# # Optional: If you want to initialize the database with a script
# COPY init.sql /docker-entrypoint-initdb.d/
# # Expose PostgreSQL default port
# EXPOSE 5432
# EXPOSE 7860
# # Command to run the application along with PostgreSQL
# CMD service postgresql start
# ENTRYPOINT ["python3", "app.py"]
# Use the official Python image as a base image
FROM python:3.8-slim
# Set environment variables
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
# Set the working directory in the container
WORKDIR /app
# Copy the requirements file into the container
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code into the container
COPY . .
# Expose the port the app runs on
EXPOSE 7860
# Start the Flask application
CMD ["flask", "run"]
|