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