Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -3
Dockerfile
CHANGED
|
@@ -1,20 +1,26 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
# Create user with UID 1000
|
| 4 |
-
RUN useradd -u 1000
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
|
|
|
| 8 |
COPY requirements.txt .
|
|
|
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
|
|
|
| 11 |
COPY . .
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
ENV APP_PORT=7152
|
| 14 |
|
| 15 |
EXPOSE 7152
|
| 16 |
|
| 17 |
-
# Switch to
|
| 18 |
USER 1000
|
| 19 |
|
| 20 |
-
CMD ["
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
# Create user with UID 1000
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Copy requirements first
|
| 9 |
COPY requirements.txt .
|
| 10 |
+
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
+
# Copy rest of app
|
| 14 |
COPY . .
|
| 15 |
|
| 16 |
+
# Change ownership of app folder
|
| 17 |
+
RUN chown -R 1000:1000 /app
|
| 18 |
+
|
| 19 |
ENV APP_PORT=7152
|
| 20 |
|
| 21 |
EXPOSE 7152
|
| 22 |
|
| 23 |
+
# Switch to non-root user
|
| 24 |
USER 1000
|
| 25 |
|
| 26 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7152"]
|