Skip to content

Commit e35bcb9

Browse files
committed
feat(docker): use overridable docker-entrypoint.sh
1 parent 3caa9f9 commit e35bcb9

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,21 @@ RUN chown $USER_NAME $STORAGE_DIR
4949
ARG EXTRA_PACKAGES="wsgi_cors_middleware"
5050
RUN pip install ${EXTRA_PACKAGES}
5151

52-
USER $USER_NAME
53-
5452
WORKDIR /app
5553

5654
ENV UWSGI_MODULE "giftless.wsgi_entrypoint"
5755

5856
ARG IS_DOCKERHUB
59-
ENV IS_DOCKERHUB=$IS_DOCKERHUB
57+
# Override default docker entrypoint for dockerhub
58+
RUN --mount=target=/build-ctx set -e ;\
59+
if [ "$IS_DOCKERHUB" = true ]; then \
60+
cp /build-ctx/scripts/docker-entrypoint-dockerhub.sh scripts/docker-entrypoint.sh ;\
61+
fi
62+
63+
USER $USER_NAME
6064

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

6569
# TODO remove this STOPSIGNAL override after uwsgi>=2.1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# Deprecation warning for images on dockerhub.
3+
4+
# ANSI color codes
5+
RED='\033[1;31m'
6+
YELLOW='\033[1;33m'
7+
RESET='\033[0m'
8+
9+
echo "${RED}**********************************************${RESET}"
10+
echo "${YELLOW}WARNING:${RESET} This Docker image from docker.io is deprecated!"
11+
echo "${YELLOW}It will no longer be maintained. Please use ghcr.io/datopian/giftless."
12+
echo "${YELLOW}Refer to https://github.com/datopian/giftless for more details."
13+
echo "${RED}**********************************************${RESET}"
14+
15+
exec "$@"

scripts/docker-entrypoint.sh

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

scripts/docker-prerun.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)