docker: add entrypoint script + env var for configuring

This commit is contained in:
Kavin 2023-11-13 17:42:22 +00:00
parent 139f5c8c90
commit 1c74bd1196
No known key found for this signature in database
GPG Key ID: 6E4598CA5C92C41F
4 changed files with 14 additions and 0 deletions

View File

@ -4,3 +4,4 @@ dist/
.*
*.md
!.prettier*
!.eslintrc.cjs

View File

@ -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" ]

View File

@ -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" ]

9
docker/entrypoint.sh Executable file
View File

@ -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;"