diff --git a/client/.env.production b/client/.env.production index 60b35ca71..40f3cd70f 100644 --- a/client/.env.production +++ b/client/.env.production @@ -1,2 +1,4 @@ -VITE_APP_HOST="http://147.182.153.60" -VITE_APP_API_BASE_URL="http://147.182.153.60:52345/api/v1" +VITE_APP_GLOBAL_REFRESH=UPTIME_APP_GLOBAL_REFRESH +VITE_APP_HOST=UPTIME_APP_HOST +VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL +VITE_APP_DEPLOYMENT_MODE=UPTIME_APP_DEPLOYMENT_MODE diff --git a/client/Dockerfile b/client/Dockerfile index 0f0312395..e0c896f5d 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -7,8 +7,14 @@ RUN npm ci COPY . . RUN npm run build -# Serve +# Run stage FROM nginx:1.27.1-alpine + +# Environment variables +COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh +RUN chmod +x /docker-entrypoint.d/env.sh + +# Serve COPY ./nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 diff --git a/client/env.sh b/client/env.sh new file mode 100644 index 000000000..d95f8ee8f --- /dev/null +++ b/client/env.sh @@ -0,0 +1,8 @@ +#!/bin/sh +for i in $(env | grep UPTIME_APP_) +do + key=$(echo $i | cut -d '=' -f 1) + value=$(echo $i | cut -d '=' -f 2-) + echo $key=$value + find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' + +done \ No newline at end of file