Skip to content

Commit

Permalink
exit on heroku-24, add error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
mble-sfdc committed May 15, 2024
1 parent a485e15 commit 747c623
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM $BUILD_IMAGE AS builder
ARG STACK

# Emulate the platform where root access is not available
USER root
RUN useradd -d /app non-root-user
RUN mkdir -p /app /cache /env
RUN chown non-root-user /app /cache /env
Expand All @@ -20,6 +21,7 @@ RUN env -i PATH=$PATH HOME=$HOME STACK=$STACK /buildpack/bin/compile /app /cache


FROM $RUNTIME_IMAGE
USER root
RUN useradd -d /app non-root-user
USER non-root-user
COPY --from=builder --chown=non-root-user /app /app
Expand Down
8 changes: 8 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ unset GIT_DIR
BUILD_DIR=$1
BUILDPACK_DIR="$(dirname $(dirname $0))"

STUNNEL=$(command -v stunnel4)

if [ -z $STUNNEL ]; then
echo "------> stunnel not detected! stunnel not supported on heroku-24+"
echo "------> this buildpack is not required for Redis 6+: https://devcenter.heroku.com/articles/heroku-redis#security-and-compliance"
exit 1
fi

echo "-----> Moving the configuration generation script into app/bin"
mkdir -p $BUILD_DIR/bin
cp "$BUILDPACK_DIR/bin/stunnel-conf.sh" $BUILD_DIR/bin/stunnel-conf.sh
Expand Down
8 changes: 8 additions & 0 deletions bin/start-stunnel
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/usr/bin/env bash

main() {
STUNNEL=$(command -v stunnel4)

if [ -z $STUNNEL ]; then
echo "buildpack=stunnel at=error stunnel not detected! stunnel not supported on heroku-24+"
echo "buildpack=stunnel at=error this buildpack is not required for Redis 6+: https://devcenter.heroku.com/articles/heroku-redis#security-and-compliance"
exit 1
fi

if ! is-enabled "${STUNNEL_ENABLED:-1}"; then
at stunnel-disabled
exec "$@"
Expand Down

0 comments on commit 747c623

Please sign in to comment.