File size: 1,125 Bytes
39fa80a 15882cb 4941aed 67d83e0 4941aed 8bba362 4941aed 8bba362 4941aed 15882cb 4941aed 67d83e0 39fa80a 67d83e0 |
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 |
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM python:3.9
# Switch to root user to perform administrative tasks
USER root
# Install MariaDB server and client
RUN apt-get update \
&& apt-get install -y mariadb-server mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Create storage directory and link
RUN mkdir -p /data/storage \
&& ln -s /data/storage /storage
# Create user and set permissions
RUN useradd -m -u 1000 user \
&& chown -R user:user /data/storage
# Create /run/mysqld and set permissions AFTER user creation
RUN mkdir -p /run/mysqld && chown user:user /run/mysqld
# Set environment variables for storage and server port
ENV STORAGE_DIR="/data/storage"
ENV SERVER_PORT=7860
# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /app
ENTRYPOINT ["/entrypoint.sh"]
|