leaderboard-docker / Dockerfile
arshy's picture
updates
db9dbb1
# Use an official Python runtime as a parent image
FROM python:3.10-slim-bullseye
# Set the working directory in the container to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install system dependencies required for building sqlite3 and other operations
RUN apt-get update && \
apt-get install -y --no-install-recommends git wget build-essential libsqlite3-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Upgrade to a more recent SQLite version
RUN wget https://www.sqlite.org/2021/sqlite-autoconf-3360000.tar.gz && \
tar xvfz sqlite-autoconf-3360000.tar.gz && \
cd sqlite-autoconf-3360000 && \
./configure --prefix=/usr --disable-static CFLAGS="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_FTS3_TOKENIZER=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_RTREE=1" && \
make && \
make install && \
cd .. && \
rm sqlite-autoconf-3360000.tar.gz && \
rm -rf sqlite-autoconf-3360000
# Verify sqlite3 version system-wide
RUN sqlite3 --version
# Install Python dependencies
RUN pip install poetry gradio
# Create a non-root user and change ownership of the /app directory
RUN adduser --disabled-password --gecos '' myuser
# Change ownership and permissions before switching to myuser
RUN chown -R myuser:myuser /app && chmod -R 755 /app && \
mkdir -p /app/.cache && chown myuser:myuser /app/.cache && \
chmod 777 /tmp
# Switch to the non-root user
USER myuser
# Expose the port Gradio runs on
EXPOSE 7860
RUN chmod +x /app/start.sh
# Run the start script when the container launches
CMD ["/app/start.sh"]