Spaces:
Sleeping
Sleeping
File size: 857 Bytes
68c9637 9598bf5 68c9637 e4b4c0d 9598bf5 68c9637 3c843c7 68c9637 7310181 68c9637 3c843c7 68c9637 4bb45ac 3c843c7 68c9637 7310181 68c9637 31c607d 68c9637 9598bf5 68c9637 |
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 32 33 34 35 36 |
# Use Python 3.11 base image
FROM python:3.11
# Update system and install git and curl
RUN apt-get update && apt-get install -y \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 appuser
# Clone LibreTranslate repository and set working directory
RUN git clone https://github.com/LibreTranslate/LibreTranslate.git
WORKDIR /LibreTranslate
# Change ownership of the application directory to the non-root user
RUN chown -R appuser:appuser /LibreTranslate
# Switch to non-root user
USER appuser
# Install Python requirements
RUN pip install --user libretranslate
# Install gunicorn
RUN pip install --user gunicorn
# Add user's local bin to PATH
ENV PATH="/home/appuser/.local/bin:${PATH}"
# Expose port 5000
EXPOSE 5000
# Run the application
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app"] |