Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DBQnA/docker_compose/intel/cpu/xeon/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu
container_name: tgi-service
ports:
- "8008:80"
- "${TGI_PORT}:80"
volumes:
- "${MODEL_CACHE:-./data}:/data"
environment:
Expand Down Expand Up @@ -35,7 +35,7 @@ services:
image: ${REGISTRY:-opea}/text2sql:${TAG:-latest}
container_name: text2sql-service
ports:
- "9090:8080"
- "${TEXT2SQL_PORT}:8080"
environment:
- TGI_LLM_ENDPOINT=${TGI_LLM_ENDPOINT}

Expand All @@ -50,6 +50,7 @@ services:
- no_proxy=${no_proxy}
- https_proxy=${https_proxy}
- http_proxy=${http_proxy}
- APP_TEXT_TO_SQL_URL=http://${host_ip}:${TEXT2SQL_PORT}/v1
ipc: host
restart: always

Expand Down
3 changes: 2 additions & 1 deletion DBQnA/ui/docker/Dockerfile.react
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ EXPOSE 80

COPY --from=vite-app /usr/app/react/dist /usr/share/nginx/html
COPY --from=vite-app /usr/app/react/nginx.conf /etc/nginx/conf.d/default.conf
COPY --chmod=0755 ./react/env.sh /docker-entrypoint.d/env.sh

ENTRYPOINT ["nginx", "-g", "daemon off;"]
ENTRYPOINT ["/docker-entrypoint.d/env.sh"]
2 changes: 1 addition & 1 deletion DBQnA/ui/react/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_TEXT_TO_SQL_URL=${TEXT_TO_SQL_URL}
VITE_TEXT_TO_SQL_URL=APP_TEXT_TO_SQL_URL
17 changes: 17 additions & 0 deletions DBQnA/ui/react/env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

for i in $(env | grep APP_) #// Make sure to use the prefix MY_APP_ if you have any other prefix in env.production file variable name replace it with MY_APP_
do
key=$(echo $i | cut -d '=' -f 1)
value=$(echo $i | cut -d '=' -f 2-)
echo $key=$value
# sed All files
# find /usr/share/nginx/html -type f -exec sed -i "s|${key}|${value}|g" '{}' +
# sed JS and CSS only
find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' +
done

# Start NGINX in the foreground
nginx -g "daemon off;"
2 changes: 1 addition & 1 deletion DBQnA/ui/react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default defineConfig({
},
define: {
// Dynamically set the hostname for the VITE_TEXT_TO_SQL_URL
"import.meta.env.VITE_TEXT_TO_SQL_URL": JSON.stringify(`http://${process.env.TEXT_TO_SQL_URL}`),
//"import.meta.env.VITE_TEXT_TO_SQL_URL": JSON.stringify(`http://${process.env.TEXT_TO_SQL_URL}`),
"import.meta.env": process.env,
},
});