Update Dockerfile
Browse files- Dockerfile +6 -10
Dockerfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
| 3 |
-
# Create user
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER root
|
| 6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
|
@@ -8,24 +8,20 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
| 8 |
# Set working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# Install dependencies
|
| 12 |
COPY ./requirements.txt requirements.txt
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
| 15 |
-
# Install curl for sshx
|
| 16 |
-
RUN apt-get update && apt-get install -y curl
|
| 17 |
-
|
| 18 |
# Copy project files
|
| 19 |
COPY . /app
|
| 20 |
|
| 21 |
# Create startup script
|
| 22 |
RUN echo '#!/bin/bash\n' \
|
| 23 |
-
'
|
| 24 |
-
'exec uvicorn app:app --host 0.0.0.0 --port 7860' \
|
| 25 |
> /app/start.sh && chmod +x /app/start.sh
|
| 26 |
|
| 27 |
-
# Use non-root user
|
| 28 |
USER user
|
| 29 |
|
| 30 |
-
# Run
|
| 31 |
-
CMD ["bash", "start.sh"]
|
|
|
|
| 1 |
FROM python:3.10
|
| 2 |
|
| 3 |
+
# Create non-root user
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
USER root
|
| 6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
|
|
|
| 8 |
# Set working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
+
# Install Python dependencies
|
| 12 |
COPY ./requirements.txt requirements.txt
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
# Copy project files
|
| 16 |
COPY . /app
|
| 17 |
|
| 18 |
# Create startup script
|
| 19 |
RUN echo '#!/bin/bash\n' \
|
| 20 |
+
'exec uvicorn main:app --host 0.0.0.0 --port 7860' \
|
|
|
|
| 21 |
> /app/start.sh && chmod +x /app/start.sh
|
| 22 |
|
| 23 |
+
# Use non-root user
|
| 24 |
USER user
|
| 25 |
|
| 26 |
+
# Run app
|
| 27 |
+
CMD ["bash", "start.sh"]
|