jatinmehra commited on
Commit
46e25d2
·
1 Parent(s): 6794844

feat: update Dockerfile to define default database path and initialize database file

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -10
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # This Dockerfile is used to build a Docker image for the CrawlGPT project using Streamlit as the front-end
2
- # Specifically for huggingface spaces
3
 
4
  # Modified Dockerfile with database support
5
  FROM python:3.12-slim
@@ -14,8 +14,8 @@ RUN apt-get update && apt-get install -y \
14
  software-properties-common \
15
  sudo \
16
  git \
17
- libsqlite3-dev \
18
- sqlite3 \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
  # Create a non-root user and set permissions
@@ -32,10 +32,9 @@ COPY pyproject.toml setup_env.py ./
32
  COPY src/ ./src/
33
  COPY tests/ ./tests/
34
  RUN chown -R appuser:appuser /app # Ensure appuser owns all files
35
- # Gotta tweak some things in our main core code (LLMBasedCrowler.py) Comment out the following line:
36
- # from dotenv import load_dotenv # line 11 It is not needed in the docker container
37
- # Because it's trying to load the API credentials from .env file which we don't have in the container
38
 
 
 
39
 
40
  # Accept the secret token as a build argument
41
  ARG GROQ_API_KEY
@@ -67,10 +66,8 @@ ENV PATH="/app/src:${PATH}"
67
  # Switch to non-root user
68
  USER appuser
69
 
70
- # Initialize database directory
71
- RUN mkdir -p /app/data && \
72
- touch ${DATABASE_PATH} && \
73
- chmod 644 ${DATABASE_PATH}
74
 
75
  # Allow appuser to install Python packages locally (user-level installations)
76
  ENV PATH="/home/appuser/.local/bin:${PATH}"
 
1
  # This Dockerfile is used to build a Docker image for the CrawlGPT project using Streamlit as the front-end
2
+ # Specifically for Hugging Face Spaces
3
 
4
  # Modified Dockerfile with database support
5
  FROM python:3.12-slim
 
14
  software-properties-common \
15
  sudo \
16
  git \
17
+ libsqlite3-dev \
18
+ sqlite3 \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
  # Create a non-root user and set permissions
 
32
  COPY src/ ./src/
33
  COPY tests/ ./tests/
34
  RUN chown -R appuser:appuser /app # Ensure appuser owns all files
 
 
 
35
 
36
+ # Define a default database path
37
+ ENV DATABASE_PATH="/app/data/database.sqlite"
38
 
39
  # Accept the secret token as a build argument
40
  ARG GROQ_API_KEY
 
66
  # Switch to non-root user
67
  USER appuser
68
 
69
+ # Initialize database file
70
+ RUN touch ${DATABASE_PATH} && chmod 644 ${DATABASE_PATH}
 
 
71
 
72
  # Allow appuser to install Python packages locally (user-level installations)
73
  ENV PATH="/home/appuser/.local/bin:${PATH}"