Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions DBQnA/docker_compose/intel/cpu/xeon/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}:9090/v1
ipc: host
restart: always

Expand Down
4 changes: 3 additions & 1 deletion DBQnA/ui/docker/Dockerfile.react
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ 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 ./react/env.sh /docker-entrypoint.d/env.sh
RUN chmod +x /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,
},
});