From 3a1fb61847414f2995c6e2e10b54a18c5f7190eb Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 21 Nov 2025 21:00:36 +0000 Subject: [PATCH] docker --- client/.env.production | 6 ++++-- client/Dockerfile | 8 +++++++- client/env.sh | 8 ++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 client/env.sh 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