sshx / Dockerfile
xdragxt's picture
Update Dockerfile
f9f7b52 verified
raw
history blame
846 Bytes
FROM python:3.10
# Create non-root 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
# Download sshx manually and place it in /usr/local/bin
RUN curl -sSfL https://s3.amazonaws.com/sshx/sshx-x86_64-unknown-linux-musl.tar.gz | \
tar -xz -C /usr/local/bin && chmod +x /usr/local/bin/sshx
# Copy project files
COPY . /app
# Create startup script
RUN echo '#!/bin/bash\n' \
'sshx run &\n' \
'exec uvicorn main:app --host 0.0.0.0 --port 7860' \
> /app/start.sh && chmod +x /app/start.sh
# Switch to non-root user
USER user
# Run the app
CMD ["bash", "start.sh"]