demo-docker-gradio / Dockerfile
sigyllly's picture
Update Dockerfile
1c9301c verified
raw
history blame
1.21 kB
# Use an official Python slim image for the base
FROM python:3.10-slim
# Set the working directory
WORKDIR /app
# Install dependencies: .NET SDK, wget, unzip, and Python pip
RUN apt-get update && apt-get install -y \
wget \
apt-transport-https \
gnupg2 \
unzip \
&& wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& apt-get update && apt-get install -y \
dotnet-sdk-7.0 \
python3-pip \
&& rm packages-microsoft-prod.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Ensure the /app directory is writable
RUN mkdir -p /app/uploads && chmod -R 777 /app/uploads
# Set the DOTNET_ROOT environment variable
ENV DOTNET_ROOT="/usr/share/dotnet"
ENV PATH="$PATH:$DOTNET_ROOT"
# Ensure csc is in the PATH
RUN echo $PATH && which csc
# Copy the requirements file
COPY ./requirements.txt /app/requirements.txt
# Install Python dependencies
RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt
# Copy the Flask app files
COPY . .
# Expose the port the app runs on
EXPOSE 7860
# Command to run the Flask app
CMD ["python3", "main.py"]