diff --git a/Dockerfile b/Dockerfile index 3077549..5623ac3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,9 @@ RUN npm run build --production FROM nginx:stable-alpine3.17-slim +COPY entrypoint.sh . +RUN chmod +x entrypoint.sh + COPY --from=builder /source/build /usr/share/nginx/html + +ENTRYPOINT ["./entrypoint.sh"] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..5fad3d2 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Generate the config.js file +cat < /usr/share/nginx/html/config.js +window._env_ = { + REACT_APP_API_HOSTNAME: "${REACT_APP_API_HOSTNAME}" + REACT_APP_KC_HOSTNAME: "${REACT_APP_KC_HOSTNAME}" +}; +EOF + +# Start Nginx +nginx -g "daemon off;" \ No newline at end of file