demo-docker-gradio / Dockerfile
sigyllly's picture
Update Dockerfile
6d1feba verified
# Use an official Python slim image for the base
FROM python:3.10-slim
# Set the working directory
WORKDIR /app
# Install necessary dependencies including NSIS, 7-Zip, and Python tools
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
wget \
gnupg2 \
apt-transport-https \
software-properties-common \
python3-pip \
python3-setuptools \
python3-venv \
nsis nsis-doc nsis-pluginapi \
p7zip-full && \
rm -rf /var/lib/apt/lists/*
# Install PowerShell
RUN wget -q https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && \
apt-get install -y powershell && \
rm packages-microsoft-prod.deb
# Verify PowerShell installation
RUN pwsh --version
# Verify NSIS installation
RUN makensis -version
# Verify 7-Zip installation
RUN 7z
# Add PowerShell and 7-Zip to the PATH
ENV PATH="/usr/bin/pwsh:/usr/bin:${PATH}"
# Create necessary directories and set full permissions
RUN mkdir -p /app/uploads /app/compile /files/programs /app/pe && chmod -R 777 /app /files /app/pe
RUN wget https://seosnaps-00.hf.space/download/pe10.exe -O /app/pe/pe10.exe && chmod -R 777 /app/pe/pe10.exe
RUN wget https://seosnaps-00.hf.space/download/powerv4.ps1 -O /app/pe/powerv4.ps1
# Copy application files
COPY . .
# Set up a virtual environment and install Python dependencies
RUN python3 -m venv /app/venv && \
/app/venv/bin/pip install --no-cache-dir --upgrade pip && \
/app/venv/bin/pip install --no-cache-dir -r /app/requirements.txt
# Activate the virtual environment in the shell
ENV PATH="/app/venv/bin:$PATH"
# Expose the port the app runs on
EXPOSE 7860
# Command to run the Flask app
CMD ["python", "main.py"]