Skip to content

Commit

Permalink
feat(docker): use overridable docker-entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
vit-zikmund committed Dec 31, 2024
1 parent 3caa9f9 commit e35bcb9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ RUN chown $USER_NAME $STORAGE_DIR
ARG EXTRA_PACKAGES="wsgi_cors_middleware"
RUN pip install ${EXTRA_PACKAGES}

USER $USER_NAME

WORKDIR /app

ENV UWSGI_MODULE "giftless.wsgi_entrypoint"

ARG IS_DOCKERHUB
ENV IS_DOCKERHUB=$IS_DOCKERHUB
# Override default docker entrypoint for dockerhub
RUN --mount=target=/build-ctx set -e ;\
if [ "$IS_DOCKERHUB" = true ]; then \
cp /build-ctx/scripts/docker-entrypoint-dockerhub.sh scripts/docker-entrypoint.sh ;\
fi

USER $USER_NAME

ENTRYPOINT ["scripts/docker-prerun.sh"]
CMD ["tini", "uwsgi", "--", "-s", "127.0.0.1:5000", "-M", "-T", "--threads", "2", "-p", "2", \
ENTRYPOINT ["tini", "--", "scripts/docker-entrypoint.sh"]
CMD ["uwsgi", "-s", "127.0.0.1:5000", "-M", "-T", "--threads", "2", "-p", "2", \
"--manage-script-name", "--callable", "app"]

# TODO remove this STOPSIGNAL override after uwsgi>=2.1
Expand Down
15 changes: 15 additions & 0 deletions scripts/docker-entrypoint-dockerhub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Deprecation warning for images on dockerhub.

# ANSI color codes
RED='\033[1;31m'
YELLOW='\033[1;33m'
RESET='\033[0m'

echo "${RED}**********************************************${RESET}"
echo "${YELLOW}WARNING:${RESET} This Docker image from docker.io is deprecated!"
echo "${YELLOW}It will no longer be maintained. Please use ghcr.io/datopian/giftless."
echo "${YELLOW}Refer to https://github.com/datopian/giftless for more details."
echo "${RED}**********************************************${RESET}"

exec "$@"
3 changes: 3 additions & 0 deletions scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
# This is a default docker entrypoint (for pre-checks) to be conditionally overridden from Dockerfile.
exec "$@"
16 changes: 0 additions & 16 deletions scripts/docker-prerun.sh

This file was deleted.

0 comments on commit e35bcb9

Please sign in to comment.