Skip to content

Commit b18f032

Browse files
invoke docs prebuild script directly
1 parent cc3541a commit b18f032

File tree

4 files changed

+16
-27
lines changed

4 files changed

+16
-27
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.env
22
__pycache__
33
sentence-transformers
4-
.tmp/*
5-
!.tmp/prebuild.sh
4+
.tmp/
65
node_modules

app/.tmp/prebuild.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ RUN pip install --no-cache-dir -r requirements.txt
3636
# Copy the application source code into the container
3737
COPY . /app
3838

39-
# Make the prebuild.sh script executable
40-
RUN chmod +x .tmp/prebuild.sh
41-
4239
# Expose port 5050 for the Flask application
4340
EXPOSE 5050
4441

app/get_knowledge_base.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,21 @@ def setup_repositories():
3232
clone_repository(repo_url, os.path.join(tmp_dir, repo_name))
3333

3434
def run_prebuild_script():
35-
""" Run the 'prebuild.sh' script located in the .tmp directory. """
36-
os.chdir(".tmp")
37-
script_path = os.path.join("./", "prebuild.sh") # Ensure the path is correct
38-
os.chdir("..")
39-
if os.path.exists(script_path):
40-
print("Running prebuild.sh...")
41-
try:
42-
subprocess.run(["bash", script_path], check=True)
43-
except subprocess.CalledProcessError as e:
44-
print(f"Error running prebuild.sh: {e}")
45-
else:
46-
print("prebuild.sh not found.")
35+
""" Run the defang-docs repo prebuild script"""
36+
37+
subprocess.run(
38+
["npm", "-C", ".tmp/defang-docs", "install"],
39+
check=True,
40+
stdout=subprocess.PIPE,
41+
stderr=subprocess.PIPE
42+
)
43+
44+
subprocess.run(
45+
["npm", "-C", ".tmp/defang-docs", "run", "prebuild"],
46+
check=True,
47+
stdout=subprocess.PIPE,
48+
stderr=subprocess.PIPE
49+
)
4750

4851
def parse_markdown():
4952
""" Parse markdown files in the current directory into JSON """

0 commit comments

Comments
 (0)