Spaces:
Sleeping
Sleeping
# Use an official Python slim image for the base | |
FROM python:3.10-slim | |
# Set the working directory | |
WORKDIR /app | |
# Install necessary dependencies including Mono, wget, 7-Zip, and Python tools | |
RUN apt-get update && apt-get install -y \ | |
wget \ | |
gnupg2 \ | |
apt-transport-https \ | |
software-properties-common \ | |
python3-pip \ | |
python3-setuptools \ | |
python3-venv \ | |
p7zip-full \ | |
&& wget https://download.mono-project.com/repo/xamarin.gpg -O /etc/apt/trusted.gpg.d/xamarin.asc \ | |
&& echo "deb https://download.mono-project.com/repo/debian stable-buster main" > /etc/apt/sources.list.d/mono-official-stable.list \ | |
&& apt-get update \ | |
&& apt-get install -y mono-complete \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set environment variables for Mono | |
ENV PATH=$PATH:/usr/bin/mono:/usr/lib/mono | |
# Verify Mono installation and its compiler | |
RUN mono --version && mcs --version | |
# Create necessary directories and set full permissions | |
RUN mkdir -p /app/uploads /app/compile && chmod -R 777 /app | |
# Copy application files | |
COPY . . | |
# Install Python dependencies | |
RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt | |
# Expose the port the app runs on | |
EXPOSE 7860 | |
# Command to run the Flask app | |
CMD ["python3", "main.py"] | |