sashdev commited on
Commit
1621405
·
verified ·
1 Parent(s): 5a41cd1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -13
Dockerfile CHANGED
@@ -1,24 +1,26 @@
1
- # Use a slim Python image as the base
2
- FROM python:3.10-slim
3
 
4
  # Install Java (required for language-tool-python)
5
- RUN apt-get update && apt-get install -y openjdk-11-jdk && rm -rf /var/lib/apt/lists/*
6
 
7
  # Set JAVA_HOME environment variable
8
  ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
9
  ENV PATH=$JAVA_HOME/bin:$PATH
10
 
11
- # Set working directory
12
- WORKDIR /app
 
13
 
14
- # Copy the current directory contents into the container
15
- COPY . /app
16
 
17
- # Install Python dependencies from requirements.txt
18
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
19
 
20
- # Expose port (if using Gradio for a web UI)
21
- EXPOSE 7860
22
 
23
- # Command to run the application
24
- CMD ["python", "app.py"]
 
1
+ # Use a base image with Python
2
+ FROM python:3.9
3
 
4
  # Install Java (required for language-tool-python)
5
+ RUN apt-get update && apt-get install -y openjdk-11-jdk
6
 
7
  # Set JAVA_HOME environment variable
8
  ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
9
  ENV PATH=$JAVA_HOME/bin:$PATH
10
 
11
+ # Create a non-root user
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
 
15
+ # Set the working directory
16
+ WORKDIR /app
17
 
18
+ # Copy the requirements.txt file and install dependencies
19
+ COPY --chown=user requirements.txt .
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Copy the entire application code
23
+ COPY --chown=user . .
24
 
25
+ # Command to run the app
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]