# Use a base image with Python | |
FROM python:3.9 | |
# Install Java (required for language-tool-python) | |
RUN apt-get update && apt-get install -y openjdk-11-jdk | |
# Set JAVA_HOME environment variable | |
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/ | |
ENV PATH=$JAVA_HOME/bin:$PATH | |
# Create a non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set the working directory | |
WORKDIR /app | |
# Copy the requirements.txt file and install dependencies | |
COPY --chown=user requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the entire application code | |
COPY --chown=user . . | |
# Command to run the app | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |