Skip to content

Commit

Permalink
Fix tmp directory in docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
cyclotruc committed Jan 2, 2025
1 parent 8d58d53 commit caacc86
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ENV PYTHONDONTWRITEBYTECODE=1

# Install git
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& apt-get install -y --no-install-recommends git curl\
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion src/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAX_DISPLAY_SIZE: int = 300_000
TMP_BASE_PATH: str = "../tmp"
TMP_BASE_PATH: str = "/tmp/gitingest"

EXAMPLE_REPOS: list[dict[str, str]] = [
{"name": "Gitingest", "url": "https://github.com/cyclotruc/gitingest"},
Expand Down
6 changes: 2 additions & 4 deletions src/gitingest/ingest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import inspect
import shutil
from pathlib import Path

from gitingest.clone import CloneConfig, clone_repo
from gitingest.ingest_from_query import ingest_from_query
Expand Down Expand Up @@ -79,10 +78,9 @@ def ingest(
f.write(tree + "\n" + content)

return summary, tree, content

finally:
# Clean up the temporary directory if it was created
if query["url"]:
# Get parent directory two levels up from local_path (../tmp)
cleanup_path = str(Path(query["local_path"]).parents[1])
# Clean up the temporary directory under /tmp/gitingest
cleanup_path = "/tmp/gitingest"
shutil.rmtree(cleanup_path, ignore_errors=True)
2 changes: 1 addition & 1 deletion src/gitingest/parse_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gitingest.exceptions import InvalidPatternError
from gitingest.ignore_patterns import DEFAULT_IGNORE_PATTERNS

TMP_BASE_PATH: str = "../tmp"
TMP_BASE_PATH: str = "/tmp/gitingest"
HEX_DIGITS = set(string.hexdigits)


Expand Down

0 comments on commit caacc86

Please sign in to comment.