vValentine7 commited on
Commit
c5b48cf
·
verified ·
1 Parent(s): 6587ff0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -1,25 +1,27 @@
1
- FROM python:3.9
2
 
3
- # Add app user
4
  RUN useradd -m -u 1000 user
 
5
  WORKDIR /app
6
 
7
- # Copy and install dependencies
8
  COPY --chown=user requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Copy source code
12
  COPY --chown=user . .
13
 
14
- # Fix permission for unzip target
15
  RUN mkdir -p /app/unzipped_zarr && chown -R user:user /app/unzipped_zarr
16
 
17
- # Enable proxy support for huggingface
18
  ENV HF_HUB_ENABLE=1
19
  ENV HF_HUB_ENABLE_PROXY=1
20
 
21
- # Expose port required by HF
22
  EXPOSE 7860
23
 
24
- # Run FastAPI app
 
25
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.10-slim
2
 
3
+ # Add a non-root user
4
  RUN useradd -m -u 1000 user
5
+
6
  WORKDIR /app
7
 
8
+ # Copy and install dependencies as that user
9
  COPY --chown=user requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
+ # Copy application code
13
  COPY --chown=user . .
14
 
15
+ # Prepare a place to unzip your Zarr
16
  RUN mkdir -p /app/unzipped_zarr && chown -R user:user /app/unzipped_zarr
17
 
18
+ # Enable HF Hub proxy mode
19
  ENV HF_HUB_ENABLE=1
20
  ENV HF_HUB_ENABLE_PROXY=1
21
 
22
+ # Expose the port Hugging Face Spaces expects
23
  EXPOSE 7860
24
 
25
+ # Run the FastAPI app under uvicorn
26
+ USER user
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]