Skip to content

Commit

Permalink
create-.env-from-env
Browse files Browse the repository at this point in the history
  • Loading branch information
fashberg committed Oct 16, 2022
1 parent 430b874 commit c21b26b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
CMD [ "npm", "start" ]
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
kutt:
image: kutt/kutt
build: .
depends_on:
- postgres
- redis
Expand Down
23 changes: 23 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"

0 comments on commit c21b26b

Please sign in to comment.