Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +36 -0
Dockerfile
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.10 slim image as base
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Create non-root user
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
RUN apt install -y git
|
| 7 |
+
# Set environment variables
|
| 8 |
+
ENV HOME=/home/user \
|
| 9 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 10 |
+
PORT=7860
|
| 11 |
+
|
| 12 |
+
# Create and set working directory
|
| 13 |
+
WORKDIR $HOME/app
|
| 14 |
+
|
| 15 |
+
# Copy requirements first to leverage Docker cache
|
| 16 |
+
COPY --chown=user requirements.txt .
|
| 17 |
+
|
| 18 |
+
# Switch to non-root user
|
| 19 |
+
USER user
|
| 20 |
+
|
| 21 |
+
# Install dependencies
|
| 22 |
+
RUN pip install --user -r requirements.txt
|
| 23 |
+
|
| 24 |
+
# Copy application files
|
| 25 |
+
RUN git clone https://github.com/ZeroTraceX/FileToLink.git temp && mv temp/* temp/.* ./ && rmdir temp
|
| 26 |
+
|
| 27 |
+
#COPY --chown=user . .
|
| 28 |
+
|
| 29 |
+
# Create uploads directory
|
| 30 |
+
#RUN mkdir -p uploads
|
| 31 |
+
|
| 32 |
+
# Expose port
|
| 33 |
+
EXPOSE ${PORT}
|
| 34 |
+
|
| 35 |
+
# Command to run the application
|
| 36 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|