Skip to content

Commit

Permalink
Create a Dockerfile for Serving API to bundle the trained model
Browse files Browse the repository at this point in the history
Rename Dockerfile for Tokenizer API
Update README
  • Loading branch information
mostafa committed Mar 8, 2024
1 parent dae1ad0 commit f8ec9bd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions Dockerfile.serving-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM tensorflow/serving

ENV MODEL_BASE_PATH=/models
ENV MODEL_NAME=sqli_model
ENV KMP_AFFINITY=noverbose
ENV TF_CPP_MIN_LOG_LEVEL=3

WORKDIR /models
COPY ./sqli_model /models/sqli_model

EXPOSE 8500
EXPOSE 8501

CMD tensorflow_model_server --port=8500 --rest_api_port=8501 --model_name=${MODEL_NAME} --model_base_path=${MODEL_BASE_PATH}/${MODEL_NAME} "$@"
File renamed without changes.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Deep learning model, dataset, trained model and related code for SQL injection d
## Docker

```bash
# Build the image
docker build --no-cache --tag deepsqli-api:latest .
# Run the DeepSQLi API container
docker run --rm --name deepsqli-api -p 8000:8000 -d deepsqli-api:latest
# Run the TensorFlow Serving API container
docker run -t --rm --name serving-api -p 8500-8501:8500-8501 -v ./sqli_model:/models/sqli_model -e MODEL_NAME=sqli_model -d tensorflow/serving
# Build the images
docker build --no-cache --tag tokenizer-api:latest -f Dockerfile.tokenizer-api .
docker build --no-cache --tag serving-api:latest -f Dockerfile.serving-api .
# Run the Tokenizer and Serving API containers
docker run --rm --name tokenizer-api -p 8000:8000 -d deepsqli-api:latest
docker run -t --rm --name serving-api -p 8500-8501:8500-8501 -d serving-api:latest
```

### Test
Expand Down

0 comments on commit f8ec9bd

Please sign in to comment.