From c21b26b56d6a0b416f49b2c8d592e87d11380ca6 Mon Sep 17 00:00:00 2001 From: Folke Ashberg Date: Sat, 15 Oct 2022 20:51:19 +0200 Subject: [PATCH] create-.env-from-env --- Dockerfile | 7 +++++-- docker-compose.yml | 2 +- entrypoint.sh | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100755 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 096adf664..fd4a9cca0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,12 +13,15 @@ RUN npm install COPY . . # Give permission to run script -RUN chmod +x ./wait-for-it.sh +RUN chmod +x ./wait-for-it.sh ./entrypoint.sh # Build files RUN npm run build EXPOSE 3000 +# entrypoint +ENTRYPOINT [ "./entrypoint.sh" ] + # Running the app -CMD [ "npm", "start" ] \ No newline at end of file +CMD [ "npm", "start" ] diff --git a/docker-compose.yml b/docker-compose.yml index 1da056a18..20c2dcfb0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3" services: kutt: - image: kutt/kutt + build: . depends_on: - postgres - redis diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 000000000..856ea4194 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +echo "entrypoint.sh" +# creates .env file for next.config.js +for param in \ + CONTACT_EMAIL \ + SITE_NAME \ + DEFAULT_DOMAIN \ + RECAPTCHA_SITE_KEY \ + GOOGLE_ANALYTICS \ + REPORT_EMAIL \ + DISALLOW_ANONYMOUS_LINKS \ + DISALLOW_REGISTRATION \ + SENTRY_PUBLIC_DSN \ + DISALLOW_CUSTOMDOMAINS \ + ; do + if [ -n "${!param}" ] ; then + echo "$param=\"${!param}\"" >>.env + fi +done + +echo "Running $@" +exec "$@" \ No newline at end of file