shevadesuyash commited on
Commit
52e3c4e
·
verified ·
1 Parent(s): b53db25

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -11
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Base image
2
  FROM python:3.10-slim
3
 
4
- # Environment variables
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1 \
7
  HOME=/app \
@@ -9,34 +9,35 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
9
  LANGTOOL_HOME=/app/.ltool_cache \
10
  XDG_CACHE_HOME=/app/.cache
11
 
12
- # Create necessary directories with full permissions
13
  RUN mkdir -p /app/.hf_cache /app/.ltool_cache /app/.cache && \
14
  chmod -R 777 /app/.hf_cache /app/.ltool_cache /app/.cache
15
 
16
- # Install system dependencies
17
  RUN apt-get update && apt-get install -y \
18
  openjdk-17-jre-headless \
19
  git \
20
- && rm -rf /var/lib/apt/lists/*
21
 
22
- # Set working directory
23
  WORKDIR /app
24
 
25
- # Copy all project files
26
  COPY . .
27
 
28
- # Install Python packages
29
  RUN pip install --upgrade pip
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
- # Cache models during build
33
  RUN python cache_models.py
34
 
35
- # Expose port
36
  EXPOSE 8080
37
 
38
- # Run the Flask app
39
  COPY entrypoint.sh /app/entrypoint.sh
40
  RUN chmod +x /app/entrypoint.sh
41
- CMD ["/app/entrypoint.sh"]
42
 
 
 
 
1
  # Base image
2
  FROM python:3.10-slim
3
 
4
+ # Environment variables for cache and config
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1 \
7
  HOME=/app \
 
9
  LANGTOOL_HOME=/app/.ltool_cache \
10
  XDG_CACHE_HOME=/app/.cache
11
 
12
+ # Create working directory and cache folders with full access
13
  RUN mkdir -p /app/.hf_cache /app/.ltool_cache /app/.cache && \
14
  chmod -R 777 /app/.hf_cache /app/.ltool_cache /app/.cache
15
 
16
+ # Install minimal dependencies including Java for LanguageTool
17
  RUN apt-get update && apt-get install -y \
18
  openjdk-17-jre-headless \
19
  git \
20
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Set the working directory
23
  WORKDIR /app
24
 
25
+ # Copy project files
26
  COPY . .
27
 
28
+ # Upgrade pip and install Python dependencies
29
  RUN pip install --upgrade pip
30
  RUN pip install --no-cache-dir -r requirements.txt
31
 
32
+ # Pre-cache models during build (optional but speeds up runtime)
33
  RUN python cache_models.py
34
 
35
+ # Expose the default Flask port
36
  EXPOSE 8080
37
 
38
+ # Entrypoint script for container start
39
  COPY entrypoint.sh /app/entrypoint.sh
40
  RUN chmod +x /app/entrypoint.sh
 
41
 
42
+ # Command to run the app
43
+ CMD ["/app/entrypoint.sh"]