# Use the official Python image from the Docker Hub | |
FROM python:3.9 | |
# Create a new user and set permissions | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set environment variables | |
ENV PATH="/home/user/.local/bin:$PATH" | |
WORKDIR /code | |
RUN pip install libretranslate waitress | |
# Copy the application code | |
COPY --chown=user . . | |
# Expose the port the app runs on | |
EXPOSE 7860 | |
# Run the application using waitress (recommended for production) | |
CMD ["waitress-serve", "--host", "0.0.0.0", "--port", "7860", "app:main"] | |