Skip to content

Commit

Permalink
Implement custom scripts (#7)
Browse files Browse the repository at this point in the history
* feat: implement custom script

* change entrypoint name + fix entrypoint command

* let execution logic in upstream /docker-entrypoint.sh

---------

Co-authored-by: Emilien Devos <[email protected]>
  • Loading branch information
f-necas and edevosc2c authored Dec 1, 2023
1 parent f2f5ff6 commit ad416e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM nginx:1.21.4-alpine
RUN rm -rf /usr/share/nginx/html/*
COPY dist/apps/datafeeder /usr/share/nginx/html
COPY nginx-default.conf /etc/nginx/conf.d/default.conf
COPY docker/copy-custom-scripts.sh /copy-custom-scripts.sh
EXPOSE 80

ENTRYPOINT ["/copy-custom-scripts.sh"]
CMD ["nginx", "-g", "daemon off;"]
14 changes: 14 additions & 0 deletions docker/copy-custom-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

DIR=/docker-entrypoint.d

# Executing custom scripts located in CUSTOM_SCRIPTS_DIRECTORY if environment variable is set
if [[ -z "${CUSTOM_SCRIPTS_DIRECTORY}" ]]; then
echo "[INFO] No CUSTOM_SCRIPTS_DIRECTORY env variable set"
else
echo "[INFO] CUSTOM_SCRIPTS_DIRECTORY env variable set to ${CUSTOM_SCRIPTS_DIRECTORY}"
cp -v "${CUSTOM_SCRIPTS_DIRECTORY}"/* "$DIR"
echo "[INFO] End copying custom scripts"
fi

exec /docker-entrypoint.sh "$@"

0 comments on commit ad416e4

Please sign in to comment.