aznasut commited on
Commit
d2a7577
·
1 Parent(s): ba23d81

ignore temp files

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -46
  2. main.py +5 -5
Dockerfile CHANGED
@@ -1,59 +1,22 @@
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.12-slim
3
 
4
- ### Set up user with permissions
5
- # Set up a new user named "user" with user ID 1000
6
- RUN useradd -m -u 1000 user
7
-
8
- # Switch to the "user" user
9
- USER user
10
-
11
- # Set home to the user's home directory
12
- ENV HOME=/home/user \
13
- PATH=/home/user/.local/bin:$PATH
14
-
15
- # Set the working directory to the user's home directory
16
- WORKDIR $HOME/app
17
-
18
- # RUN apt-get update && apt-get install -y \
19
- # gcc \
20
- # build-essential \
21
- # pkg-config \
22
- # libhdf5-dev \
23
- # && rm -rf /var/lib/apt/lists/*
24
-
25
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
26
- COPY --chown=user . $HOME/app
27
-
28
- ### Set up app-specific content
29
- COPY requirements.txt requirements.txt
30
- RUN pip install --no-cache-dir -r requirements.txt
31
-
32
- COPY . .
33
-
34
- ### Update permissions for the app
35
- USER root
36
- RUN chmod 777 ~/app/*
37
- USER user
38
-
39
  # Set the working directory in the container
40
  WORKDIR /app
41
 
42
  # Install system dependencies
43
- # RUN apt-get update && apt-get install -y \
44
- # gcc \
45
- # build-essential \
46
- # pkg-config \
47
- # libhdf5-dev \
48
- # && rm -rf /var/lib/apt/lists/*
49
 
50
  # Copy the current directory contents into the container at /app
51
- # COPY . /app
52
 
53
- # RUN useradd -m -u 1000 user
54
- # COPY --chown=user . /app
55
- # # Install any needed packages specified in requirements.txt
56
- # RUN pip install --no-cache-dir -r requirements.txt
57
 
58
  # Make port 7680 available to the world outside this container
59
  EXPOSE 7860
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.12-slim
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
  # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ gcc \
10
+ build-essential \
11
+ pkg-config \
12
+ libhdf5-dev \
13
+ && rm -rf /var/lib/apt/lists/*
14
 
15
  # Copy the current directory contents into the container at /app
16
+ COPY . /app
17
 
18
+ # Install any needed packages specified in requirements.txt
19
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
20
 
21
  # Make port 7680 available to the world outside this container
22
  EXPOSE 7860
main.py CHANGED
@@ -6,12 +6,12 @@ from fastapi import FastAPI, File, UploadFile, HTTPException
6
  from fastapi.responses import JSONResponse
7
 
8
  import os
9
- from os import path
10
- cache_path = path.join(path.dirname(path.abspath(__file__)), "models")
11
 
12
- os.environ["TRANSFORMERS_CACHE"] = cache_path
13
- os.environ["HF_HUB_CACHE"] = cache_path
14
- os.environ["HF_HOME"] = cache_path
15
 
16
  # PATH = 'huggingface'
17
  # DATASETPATH = '/home/ahmadzen/.cache/huggingface/datasets'
 
6
  from fastapi.responses import JSONResponse
7
 
8
  import os
9
+ # from os import path
10
+ # cache_path = path.join(path.dirname(path.abspath(__file__)), "models")
11
 
12
+ # os.environ["TRANSFORMERS_CACHE"] = cache_path
13
+ # os.environ["HF_HUB_CACHE"] = cache_path
14
+ # os.environ["HF_HOME"] = cache_path
15
 
16
  # PATH = 'huggingface'
17
  # DATASETPATH = '/home/ahmadzen/.cache/huggingface/datasets'