From 5a8f7d037403d855324b3763266793ba74b94d5e Mon Sep 17 00:00:00 2001 From: Matt Conway Date: Tue, 22 Jun 2021 14:50:34 -0400 Subject: [PATCH] fix bundler for multi-target dockerfile --- Dockerfile | 5 +++-- bin/kubetruth | 1 + bin/liquid | 1 + entrypoint.sh | 11 +++-------- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1451880..7997ff3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ ENV APP_DIR="/srv/app" \ # values because Docker will read the values once before it starts setting # values. ENV BUNDLE_BIN="${BUNDLE_PATH}/bin" \ + BUNDLE_APP_CONFIG="${BUNDLE_PATH}" \ GEM_HOME="${BUNDLE_PATH}" ENV PATH="${APP_DIR}:${APP_DIR}/bin:${BUNDLE_BIN}:${PATH}" @@ -28,7 +29,7 @@ RUN apk add --no-cache \ $BUILD_PACKAGES COPY Gemfile* $APP_DIR/ -RUN bundle config --global without 'development test' && \ +RUN bundle config --local without 'development test' && \ bundle install --jobs=4 RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing kubectl @@ -38,7 +39,7 @@ COPY . $APP_DIR/ FROM build as development -RUN bundle config --delete without && \ +RUN bundle config --local --delete without && \ bundle install --jobs=4 # Specify the script to use when running the container diff --git a/bin/kubetruth b/bin/kubetruth index b5bdd19..49124d7 100755 --- a/bin/kubetruth +++ b/bin/kubetruth @@ -1,6 +1,7 @@ #!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path("../lib", __dir__) +require "bundler/setup" require "kubetruth" require 'kubetruth/cli' diff --git a/bin/liquid b/bin/liquid index c2817eb..01c86b5 100755 --- a/bin/liquid +++ b/bin/liquid @@ -1,6 +1,7 @@ #!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path("../lib", __dir__) +require "bundler/setup" require "kubetruth" require 'kubetruth/cli_liquid_tester' diff --git a/entrypoint.sh b/entrypoint.sh index bdec24d..296a532 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,17 +9,17 @@ case $action in app) echo "Starting app" - exec bundle exec kubetruth "$@" + exec kubetruth "$@" ;; console) echo "Starting console" - exec bundle exec rake console + exec rake console ;; test) echo "Starting tests" - exec bundle exec rspec + exec rspec ;; bash) @@ -31,12 +31,7 @@ case $action in exec bash "${bash_args[@]}" ;; - exec) - exec "$@" - ;; - *) - echo "Unknown action: '$action', defaulting to exec" exec $action "$@" ;;