Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(openchallenges): patch the entry point script of Thumbor to replace 'None' by None (IT-3908) #2856

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/openchallenges/thumbor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
FROM beeyev/thumbor-s3:7.7-slim-alpine
FROM beeyev/thumbor-s3:7.7-slim-alpine

COPY --chmod=0755 ./docker-entrypoint.sh /docker-entrypoint.sh
58 changes: 58 additions & 0 deletions apps/openchallenges/thumbor/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
# Alexander Tebiev - https://github.com/beeyev

#String Colors
NC='\033[0;m' # Default Color
GRN='\033[32;1m'
RED='\033[31;1m'
BLK='\033[30;1m'
GRY='\033[90;1m'

# Set the number of cpu cores
export NUM_CPUS=`nproc`

if [ ! -f /app/thumbor.conf ]; then
envtpl /usr/local/etc/thumbor.conf.tpl --allow-missing --keep-template
sed -i "s/'None'/None/g" /usr/local/etc/thumbor.conf
else
sed -i "s/'None'/None/g" /app/thumbor.conf
fi

# If log level is defined we configure it, else use default log_level = info
if [[ -n "${LOG_LEVEL}" ]]
then
LOG_PARAMETER="--log-level=${LOG_LEVEL}"
fi

# Check if thumbor port is defined -> (default port 8888)
if [[ -n "${PORT}" ]]
then
PORT_PARAMETER="--port=${PORT}"
fi

# Set number of processes
if [[ -n "${NUM_PROCESSES}" ]]
then
NUM_PROCESSES_PARAMETER="--processes=${NUM_PROCESSES}"
fi

# Run custom script before the main docker process gets started
for f in /docker-entrypoint.init.d/*; do
case "$f" in
*.sh) # this should match the set of files we check for below
echo "⚙ Executing entrypoint.init file: ${f}"
. $f
break
;;
esac
done

THUMBOR_EXEC="thumbor ${PORT_PARAMETER} --conf=/usr/local/etc/thumbor.conf ${LOG_PARAMETER} ${NUM_PROCESSES_PARAMETER}"

printf "\n\n${GRN}--->${NC} $($(which thumbor) --version)"
printf "\n${GRN}--->${NC} Starting Thumbor on port: ${GRN}${PORT}${NC}, log level: ${GRN}${LOG_LEVEL}${NC}, CPU cores available: ${GRN}${NUM_CPUS}${NC}"
printf "\n${GRN}--->${NC} Exec command: ${GRY}${THUMBOR_EXEC}${NC}"
printf "\n${GRN}--->${NC} Docker image build date: ${GRY}${BUILD_DATE}${NC}, fingerprint: ${GRY}${BUILD_FINGERPRINT}${NC}"
printf "\n${GRN}--->${NC} Docker image project url: ${GRY}https://github.com/beeyev/thumbor-s3-docker${NC}\n\n"
exec ${THUMBOR_EXEC}

Loading