NitinBot001's picture
Update Dockerfile
86b00a3 verified
raw
history blame
1.03 kB
# 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
ENV LT_LOAD_ONLY="en,es,fr,de,it,pt,ru,zh,ja,ar,hi,tr,pl,nl,sv,da,no,fi,cs,sk,hu,ro,bg,hr,sl,et,lv,lt,mt,ga,cy,is,mk,sq,bs,sr,uk,be,kk,ky,uz,tg,mn,ka,am,az,hy,eu,ca,gl"
# Run the application
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app"]