Skip to content

Commit

Permalink
Merge pull request #195 from SAP/patch/141
Browse files Browse the repository at this point in the history
upgrade docker
  • Loading branch information
marcorosa authored Sep 6, 2021
2 parents aa51f73 + ecb6a94 commit 03e728b
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion credentialdigger/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def add_embedding(self, query, discovery_id, repo_url, embedding=None):
cursor = self.db.cursor()
try:
cursor.execute(query, (discovery_id,
embedding,
snippet,
embedding,
repo_url))
self.db.commit()
except self.Error:
Expand Down
8 changes: 4 additions & 4 deletions credentialdigger/client_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def add_embedding(self, discovery_id, repo_url, embedding=None):
embedding: list
The embedding being added
"""
query = 'INSERT INTO embeddings (id, embedding, snippet, repo_url) \
query = 'INSERT INTO embeddings (id, snippet, embedding, repo_url) \
VALUES (%s, %s, %s, %s);'
super().add_embedding(query,
discovery_id,
Expand All @@ -223,7 +223,7 @@ def add_embeddings(self, repo_url):
repo_url: str
The discoveries' repository url
"""
query = 'INSERT INTO embeddings (id, embedding, snippet, repo_url) \
query = 'INSERT INTO embeddings (id, snippet, embedding, repo_url) \
VALUES (%s, %s, %s, %s);'
super().add_embeddings(query, repo_url)

Expand Down Expand Up @@ -466,9 +466,9 @@ def get_embedding(self, discovery_id=None, snippet=None):
snippet or id
"""
if discovery_id:
query = 'SELECT embedding FROM embeddings WHERE id=%s'
query = 'SELECT embedding FROM embeddings WHERE id=%s;'
elif snippet:
query = 'SELECT embedding FROM embeddings WHERE snippet=%s'
query = 'SELECT embedding FROM embeddings WHERE snippet=%s;'
else:
return None
return super().get_embedding(query=query,
Expand Down
2 changes: 1 addition & 1 deletion credentialdigger/client_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def add_embedding(self, discovery_id, repo_url, embedding=None):
repo_url: str
The discovery's repository url
"""
query = 'INSERT INTO embeddings (id, embedding, snippet, repo_url) \
query = 'INSERT INTO embeddings (id, snippet, embedding, repo_url) \
VALUES (?, ?, ?, ?);'
return super().add_embedding(query,
discovery_id,
Expand Down
1 change: 1 addition & 0 deletions docker-compose.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- path_model=$path_model
- snippet_model=$snippet_model
container_name: credential_digger_backend
image: credential-digger_pg
restart: always
env_file:
- ./.env
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ services:
- SSL_certificate=$SSL_certificate
- SSL_private_key=$SSL_private_key
container_name: credential_digger_sqlite
image: credential-digger_sqlite
restart: always
env_file:
- ./.env
ports:
- "5000:5000"
- "5000:5000"
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rich
scikit-learn
srsly>=2.4.0
tensorflow==2.5.1; python_version >= "3.8"
tensorflow==2.4.2; python_version < "3.8"
tensorflow==2.4.*; python_version < "3.8"
tensorflow-text==2.5.0; python_version >= "3.8"
tensorflow-text==2.4.2; python_version < "3.8"
tf-models-official
tensorflow-text==2.4.*; python_version < "3.8"
tf-models-official
2 changes: 1 addition & 1 deletion sql/create_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ CREATE TABLE discoveries (

CREATE TABLE embeddings (
id INTEGER REFERENCES discoveries,
embedding TEXT,
snippet TEXT,
embedding TEXT,
repo_url TEXT REFERENCES repos,
PRIMARY KEY (id)
);
2 changes: 1 addition & 1 deletion ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.9-bullseye

RUN pip install flask_jwt_extended Flask python-dotenv
RUN apt-get update && apt-get install -y libhyperscan5 libpq-dev gunicorn3
Expand Down

0 comments on commit 03e728b

Please sign in to comment.