MJSHIN0122 commited on
Commit
7e37010
β€’
1 Parent(s): 8a4c09f

initialize

Browse files
Files changed (3) hide show
  1. Dockerfile +23 -5
  2. app.py +1 -0
  3. entrypoint.sh +3 -0
Dockerfile CHANGED
@@ -1,11 +1,29 @@
1
- FROM python:3.9
2
 
3
- WORKDIR /code
 
 
 
4
 
5
- COPY ./requirements.txt /code/requirements.txt
 
6
 
7
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
 
 
8
 
9
  COPY . .
10
 
11
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.8-slim
2
 
3
+ # ν•„μš”ν•œ νŒ¨ν‚€μ§€ μ„€μΉ˜ (μ—¬κΈ°μ„œλŠ” git 포함)
4
+ RUN apt-get update \
5
+ && apt-get install -y git \
6
+ && rm -rf /var/lib/apt/lists/*
7
 
8
+ # non-root μ‚¬μš©μž 생성
9
+ RUN useradd -m myuser
10
 
11
+ # μž‘μ—… 디렉토리 μ„€μ •
12
+ WORKDIR /app
13
+
14
+ COPY requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
 
17
  COPY . .
18
 
19
+ # 파일 μ†Œμœ κΆŒ λ³€κ²½
20
+ RUN chown -R myuser:myuser /app
21
+
22
+
23
+ COPY entrypoint.sh entrypoint.sh
24
+ RUN chmod +x entrypoint.sh
25
+
26
+ # μ‚¬μš©μž λ³€κ²½
27
+ USER myuser
28
+
29
+ CMD ["./entrypoint.sh"]
app.py CHANGED
@@ -9,4 +9,5 @@ Repo.clone_from(f"https://MJSHIN0122:{access_token}@hf.co:spaces/MJSHIN0122/llm_
9
  print("Clone Done.")
10
 
11
  sys.path.append(os.path.abspath("./repo_directory"))
 
12
  import repo_directory.api_main as app
 
9
  print("Clone Done.")
10
 
11
  sys.path.append(os.path.abspath("./repo_directory"))
12
+ sys.path.append(os.path.abspath("./repo_directory/src"))
13
  import repo_directory.api_main as app
entrypoint.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/bin/sh
2
+ python app.py
3
+ gunicorn -b 0.0.0.0:7860 repo_directory.api_app:app