Imarticuslearning commited on
Commit
ec1c3da
·
verified ·
1 Parent(s): b60a03f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -1,30 +1,29 @@
1
  FROM python:3.10-slim
2
 
3
- # Install Java (required for language-tool-python)
4
  RUN apt-get update && \
5
  apt-get install -y openjdk-17-jre-headless curl && \
6
  apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
8
- # Set Java environment
9
  ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
10
  ENV PATH="${JAVA_HOME}/bin:${PATH}"
11
 
12
- # Set safe user-owned cache directories
13
  ENV HOME=/app
14
- ENV USER=root
15
  ENV STREAMLIT_HOME=/app/.streamlit
16
  ENV XDG_CACHE_HOME=/app/.cache
17
 
18
- # Create necessary directories
19
- RUN mkdir -p /app/.streamlit /app/.cache
20
-
21
- # Install Python dependencies
22
  COPY requirements.txt .
23
  RUN pip install --no-cache-dir -r requirements.txt
24
 
25
- # Copy your code
26
  COPY . /app
27
- WORKDIR /app
28
 
29
- # Run your app
 
 
 
 
30
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.enableCORS=false"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Install Java for language-tool-python
4
  RUN apt-get update && \
5
  apt-get install -y openjdk-17-jre-headless curl && \
6
  apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
8
+ # Set Java env
9
  ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
10
  ENV PATH="${JAVA_HOME}/bin:${PATH}"
11
 
12
+ # Environment variables for Streamlit and cache
13
  ENV HOME=/app
 
14
  ENV STREAMLIT_HOME=/app/.streamlit
15
  ENV XDG_CACHE_HOME=/app/.cache
16
 
17
+ # Copy code and install dependencies
18
+ WORKDIR /app
 
 
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
 
22
  COPY . /app
 
23
 
24
+ # Ensure write permission for non-root user (user 1000)
25
+ RUN mkdir -p /app/.streamlit /app/.cache/language_tool_python && \
26
+ chown -R 1000:1000 /app
27
+
28
+ # Run the Streamlit app
29
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.enableCORS=false"]