Create Dockerfile
Browse files- Dockerfile +36 -0
Dockerfile
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight official Python image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Install system dependencies required for C++ binaries, file operations, and curl
|
| 5 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
+
build-essential \
|
| 7 |
+
curl \
|
| 8 |
+
libgomp1 \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Set up a working directory inside the container
|
| 12 |
+
WORKDIR /code
|
| 13 |
+
|
| 14 |
+
# Copy requirement configuration file first to leverage Docker layer caching
|
| 15 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 16 |
+
|
| 17 |
+
# Install python dependencies
|
| 18 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy the rest of your application code into the container
|
| 21 |
+
COPY . .
|
| 22 |
+
|
| 23 |
+
# CRITICAL: Grant executable permissions to your C++ inference binary
|
| 24 |
+
RUN chmod +x /code/fastvlm_server
|
| 25 |
+
|
| 26 |
+
# Create a secure temporary directory for permissions compliance on Hugging Face
|
| 27 |
+
RUN mkdir -p /tmp && chmod 777 /tmp
|
| 28 |
+
ENV TMPDIR=/tmp
|
| 29 |
+
|
| 30 |
+
# Hugging Face Spaces expect containers to listen on port 7860
|
| 31 |
+
EXPOSE 7860
|
| 32 |
+
|
| 33 |
+
RUN chmod +x /code/start.sh
|
| 34 |
+
|
| 35 |
+
# Run the orchestration script
|
| 36 |
+
CMD ["./start.sh"]
|