NitinBot001's picture
Update Dockerfile
4bb45ac verified
raw
history blame
857 Bytes
# 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"]