BitNet.cpp / Dockerfile
MekkCyber
initial_commit
ec1b552
raw
history blame
1.47 kB
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Install git as root
RUN apt-get update && \
apt-get install -y wget gnupg nmap && \
# Add the LLVM repository for clang
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-15 main" > /etc/apt/sources.list.d/llvm-toolchain.list && \
apt-get update && \
apt-get install -y git cmake clang && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user (do this as root)
RUN useradd -ms /bin/bash myuser
# Set the working directory as root before switching users
WORKDIR /home/myuser/app
# Copy files and change permissions as root
COPY requirements.txt /home/myuser/app/requirements.txt
COPY setup.sh /home/myuser/app/setup.sh
RUN chmod +x /home/myuser/app/setup.sh
# Install Python dependencies as root
RUN pip install --no-cache-dir -r /home/myuser/app/requirements.txt
# Run setup.sh as root (if it needs elevated privileges)
RUN /home/myuser/app/setup.sh
# Change ownership of the directory to myuser
RUN chown -R myuser:myuser /home/myuser/app
# Switch to the non-root user
USER myuser
RUN ls /home/myuser/app
# Copy the rest of the application code to the container (as myuser)
COPY . /home/myuser/app
# Expose the necessary port
EXPOSE 7860
# Set environment variable for Gradio
ENV GRADIO_SERVER_NAME="0.0.0.0"
# Command to run the application
CMD ["python", "app.py"]