# # Use an official Python runtime as a parent image # FROM python:3.9-slim # # Set the working directory inside the container # WORKDIR /app # # Copy the current directory contents into the container at /app # COPY . /app # # Install dependencies required for the app (including Java) # RUN apt-get update && apt-get install -y \ # curl \ # && rm -rf /var/lib/apt/lists/* # # Download and install OpenJDK from the tar.gz file # COPY jdk-11.0.25_linux-x64_bin.tar.gz /app/ # # Extract the tar.gz file and set JAVA_HOME # RUN tar -xvzf jdk-11.0.25_linux-x64_bin.tar.gz && \ # mv jdk-11.0.25 /usr/local/openjdk-11 && \ # rm jdk-11.0.25_linux-x64_bin.tar.gz # # Set JAVA_HOME environment variable and update PATH # ENV JAVA_HOME /usr/local/openjdk-11 # ENV PATH $JAVA_HOME/bin:$PATH # ENV TRANSFORMERS_CACHE=/tmp/huggingface # # Install Python dependencies # RUN pip install --no-cache-dir -r requirements.txt # # Expose the port that the app will run on # EXPOSE 8080 # # Run the Flask app # CMD ["python", "app.py"] # Use official Python runtime # Use official Python runtime # FROM python:3.9-slim # # Set the working directory # WORKDIR /app # # Install system dependencies # RUN apt-get update && apt-get install -y \ # curl \ # unzip \ # libgomp1 \ # && rm -rf /var/lib/apt/lists/* # # Install Java (using your JDK method) # COPY jdk-11.0.25_linux-x64_bin.tar.gz /tmp/ # RUN tar -xzf /tmp/jdk-11.0.25_linux-x64_bin.tar.gz -C /opt && \ # rm /tmp/jdk-11.0.25_linux-x64_bin.tar.gz # # Set Java environment variables # ENV JAVA_HOME=/opt/jdk-11.0.25 # ENV PATH=$JAVA_HOME/bin:$PATH # # Create and configure cache directories # RUN mkdir -p /app/cache/huggingface \ # && mkdir -p /app/cache/languagetool \ # && chmod -R 777 /app/cache # # Set environment variables # ENV TRANSFORMERS_CACHE=/app/cache/huggingface # ENV HF_HOME=/app/cache/huggingface # ENV XDG_CACHE_HOME=/app/cache # ENV LT_CACHE=/app/cache/languagetool # ENV LANGUAGE_TOOL_HOME=/app/cache/languagetool # # Copy requirements first for better layer caching # COPY requirements.txt . # RUN pip install --no-cache-dir -r requirements.txt # # Copy application code # COPY . . # EXPOSE 8080 # CMD ["python", "app.py"] FROM python:3.9-slim # Set the working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ unzip \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Install Java using your JDK method COPY jdk-11.0.25_linux-x64_bin.tar.gz /tmp/ RUN tar -xzf /tmp/jdk-11.0.25_linux-x64_bin.tar.gz -C /opt && \ rm /tmp/jdk-11.0.25_linux-x64_bin.tar.gz # Set Java environment variables ENV JAVA_HOME=/opt/jdk-11.0.25 ENV PATH=$JAVA_HOME/bin:$PATH # Create and configure cache directories RUN mkdir -p /app/cache/huggingface \ && mkdir -p /app/cache/languagetool \ && chmod -R 777 /app/cache # Set environment variables ENV TRANSFORMERS_CACHE=/app/cache/huggingface ENV HF_HOME=/app/cache/huggingface ENV XDG_CACHE_HOME=/app/cache ENV LT_CACHE=/app/cache/languagetool ENV LANGUAGE_TOOL_HOME=/app/cache/languagetool ENV PORT=7860 # Copy requirements first for better layer caching COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Run the app on port 7860 (required by Spaces) CMD ["python", "app.py"]