3v324v23 commited on
Commit
4e30d0e
·
1 Parent(s): 9cf2270

測試Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -13
Dockerfile CHANGED
@@ -1,24 +1,17 @@
1
  FROM python:3.12.10-slim
2
 
3
- # Update packages and install curl for health check
4
- RUN apt-get update && apt-get upgrade -y && apt-get install -y curl=7.74.0-1.3+deb11u3 && rm -rf /var/lib/apt/lists/*
5
-
6
- # Create a non-root user
7
- RUN useradd --create-home appuser
8
-
9
  WORKDIR /code
10
 
11
- # Copy files with proper ownership
12
- COPY --chown=appuser:appuser ./requirements.txt /code/requirements.txt
13
 
14
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
15
 
16
- COPY --chown=appuser:appuser . .
17
 
18
- # Add HEALTHCHECK instruction
19
- HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost:7860/ || exit 1
20
 
21
- # Switch to non-root user
22
  USER appuser
23
 
24
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "gpt4:app"]
 
 
 
1
  FROM python:3.12.10-slim
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
+ RUN adduser --disabled-password --gecos "" appuser && chown -R appuser /code
 
12
 
 
13
  USER appuser
14
 
15
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -f http://0.0.0.0:7860/ || exit 1
16
+
17
+ CMD ["gunicorn","-b", "0.0.0.0:7860", "gpt4:app"]