From 1c74bd1196172e52da7f23fcbf08ba68bc3cd911 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 13 Nov 2023 17:42:22 +0000 Subject: [PATCH] docker: add entrypoint script + env var for configuring --- .dockerignore | 1 + Dockerfile | 2 ++ Dockerfile.ci | 2 ++ docker/entrypoint.sh | 9 +++++++++ 4 files changed, 14 insertions(+) create mode 100755 docker/entrypoint.sh diff --git a/.dockerignore b/.dockerignore index ab2a8d67..b9672806 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,3 +4,4 @@ dist/ .* *.md !.prettier* +!.eslintrc.cjs diff --git a/Dockerfile b/Dockerfile index 03e56bcd..e9de96b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,5 +19,7 @@ FROM nginx:alpine COPY --from=build /app/dist/ /usr/share/nginx/html/ COPY docker/nginx.conf /etc/nginx/conf.d/default.conf +COPY docker/entrypoint.sh /entrypoint.sh EXPOSE 80 +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/Dockerfile.ci b/Dockerfile.ci index d020ebfc..59020fd6 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -2,5 +2,7 @@ FROM nginx:alpine COPY ./dist-ci/ /usr/share/nginx/html/ COPY docker/nginx.conf /etc/nginx/conf.d/default.conf +COPY docker/entrypoint.sh /entrypoint.sh EXPOSE 80 +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 00000000..ffb9c7ed --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -z "$BACKEND_HOSTNAME" ]; then + echo "BACKEND_HOSTNAME not set" + exit 1 +fi + +sed -i s/pipedapi.kavin.rocks/"$BACKEND_HOSTNAME"/g /usr/share/nginx/html/assets/* +nginx -g "daemon off;"