Skip to content

Commit 8fc8c72

Browse files
TheOneFromNorwaytvararu
authored andcommitted
Move export of ENV_VARS
- Docker entry point is top level so this is where the environment variables must be extracted - Otherwise shelling into the container and also db:seed does not execute properly
1 parent 467429f commit 8fc8c72

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

bin/docker-entrypoint

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ if [ -z "${LD_PRELOAD+x}" ]; then
66
export LD_PRELOAD
77
fi
88

9+
10+
# Extract ENV_VARS into set of variables and export them to the shell
11+
if [ -n "$ENV_VARS" ]; then
12+
IFS=',' read -ra ADDR <<< "$ENV_VARS"
13+
for i in "${ADDR[@]}"; do
14+
if [[ "$i" == *"="* ]]; then
15+
export "${i?}"
16+
echo "Exported: $i"
17+
fi
18+
done
19+
fi
20+
921
# When starting the container then create or migrate existing database
1022
if [ "$1" == "./bin/docker-start" ]; then
1123
./bin/rails db:prepare:ignore_concurrent_migration_exceptions

bin/docker-start

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22

33
BIN_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44

5-
# Extract ENV_VARS into set of variables and export them to the shell
6-
if [ -n "$ENV_VARS" ]; then
7-
IFS=',' read -ra ADDR <<< "$ENV_VARS"
8-
for i in "${ADDR[@]}"; do
9-
if [[ "$i" == *"="* ]]; then
10-
export "${i?}"
11-
echo "Exported: $i"
12-
fi
13-
done
14-
fi
15-
165
if [ "$SERVER_TYPE" == "web" ]; then
176
echo "Starting web server..."
187
exec "$BIN_DIR"/thrust "$BIN_DIR"/rails server

script/shell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,5 @@ aws ecs execute-command --region "$region" \
161161
--cluster "$cluster_name" \
162162
--task "$task_id" \
163163
--container "$container_name" \
164-
--command "/bin/bash" \
164+
--command "/rails/bin/docker-entrypoint /bin/bash" \
165165
--interactive

0 commit comments

Comments
 (0)