Skip to content

Commit

Permalink
Fix dockerfile format (opea-project#363)
Browse files Browse the repository at this point in the history
Signed-off-by: zepan <[email protected]>
  • Loading branch information
ZePan110 authored Jul 31, 2024
1 parent 767a14c commit eb5cc8a
Show file tree
Hide file tree
Showing 33 changed files with 39 additions and 2,213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker/code-scan.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ARG UBUNTU_VER=22.04
FROM ubuntu:${UBUNTU_VER} as devel

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
aspell \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker/ut.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ARG UBUNTU_VER=22.04
FROM ubuntu:${UBUNTU_VER} as devel

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
aspell \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/codeScan/bandit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
source /GenAIComps/.github/workflows/scripts/change_color
pip install bandit==1.7.8
log_dir=/GenAIComps/.github/workflows/scripts/codeScan
python -m bandit -r -lll -iii /GenAIComps 2>&1 | tee ${log_dir}/bandit.log
python -m bandit -r -lll -iii /GenAIComps > ${log_dir}/bandit.log
exit_code=$?

$BOLD_YELLOW && echo " ----------------- Current log file output start --------------------------"
Expand Down
2 changes: 1 addition & 1 deletion comps/agent/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

FROM python:3.11-slim

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
Expand Down
2 changes: 1 addition & 1 deletion comps/chathistory/mongo/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

FROM python:3.11-slim

ENV LANG C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
build-essential \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def prepare_env(enable_ray=False, pip_requirements=None):
def generate_log_name(file_list):
file_set = f"{sorted(file_list)}"
# print(f"file_set: {file_set}")
md5_str = hashlib.md5(file_set.encode()).hexdigest()
md5_str = hashlib.md5(file_set.encode(), usedforsecurity=False).hexdigest()
return f"status/status_{md5_str}.log"


Expand Down
29 changes: 27 additions & 2 deletions comps/dataprep/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import re
import shutil
import signal
import subprocess
import timeit
import unicodedata
import urllib.parse
Expand Down Expand Up @@ -157,7 +158,19 @@ def load_doc(doc_path):
"""Load doc file."""
print("Converting doc file to docx file...")
docx_path = doc_path + "x"
os.system(f"libreoffice --headless --invisible --convert-to docx --outdir {os.path.dirname(docx_path)} {doc_path}")
subprocess.run(
[
"libreoffice",
"--headless",
"--invisible",
"--convert-to",
"docx",
"--outdir",
os.path.dirname(docx_path),
doc_path,
],
check=True,
)
print("Converted doc file to docx file.")
text = load_docx(docx_path)
os.remove(docx_path)
Expand Down Expand Up @@ -196,7 +209,19 @@ def load_ppt(ppt_path):
"""Load ppt file."""
print("Converting ppt file to pptx file...")
pptx_path = ppt_path + "x"
os.system(f"libreoffice --headless --invisible --convert-to pptx --outdir {os.path.dirname(pptx_path)} {ppt_path}")
subprocess.run(
[
"libreoffice",
"--headless",
"--invisible",
"--convert-to",
"docx",
"--outdir",
os.path.dirname(pptx_path),
ppt_path,
],
check=True,
)
print("Converted ppt file to pptx file.")
text = load_pptx(pptx_path)
os.remove(pptx_path)
Expand Down
4 changes: 3 additions & 1 deletion comps/guardrails/pii_detection/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import multiprocessing
import os
import re
import subprocess
import unicodedata
from urllib.parse import urlparse, urlunparse

Expand Down Expand Up @@ -79,7 +80,8 @@ def load_doc(doc_path):
"""Load doc file."""
txt_path = doc_path.replace(".doc", ".txt")
try:
os.system(f'antiword "{doc_path}" > "{txt_path}"')
with open(txt_path, "w") as outfile:
subprocess.run(["antiword", doc_path], stdout=outfile, check=True)
except:
raise AssertionError(
"antiword failed or not installed, if not installed,"
Expand Down
2 changes: 1 addition & 1 deletion comps/guardrails/pii_detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def wrapper(*args, **kwargs):
def generate_log_name(file_list):
file_set = f"{sorted(file_list)}"
# print(f"file_set: {file_set}")
md5_str = hashlib.md5(file_set.encode()).hexdigest()
md5_str = hashlib.md5(file_set.encode(), usedforsecurity=False).hexdigest()
return f"status/status_{md5_str}.log"


Expand Down
78 changes: 0 additions & 78 deletions comps/llms/text-generation/ray_serve/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions comps/llms/text-generation/ray_serve/__init__.py

This file was deleted.

This file was deleted.

Loading

0 comments on commit eb5cc8a

Please sign in to comment.