Skip to content

Commit

Permalink
Create abstraction for dependent image names
Browse files Browse the repository at this point in the history
Instead of using ${X_NAME}:${X_TAG} use ${X}
so that I can work towards including the digest in ${X}
  • Loading branch information
JonJagger committed Feb 2, 2025
1 parent 6e7b8a8 commit da3dbd0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
10 changes: 0 additions & 10 deletions .env
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
CYBER_DOJO_PROMETHEUS=true
CYBER_DOJO_CUSTOM_START_POINTS_PORT=4526
CYBER_DOJO_EXERCISES_START_POINTS_PORT=4525
CYBER_DOJO_LANGUAGES_START_POINTS_PORT=4524
CYBER_DOJO_CREATOR_PORT=4523
CYBER_DOJO_MODEL_PORT=4528
CYBER_DOJO_DASHBOARD_PORT=4527
CYBER_DOJO_DIFFER_PORT=4567
CYBER_DOJO_NGINX_PORT=80
CYBER_DOJO_REPLER_PORT=4657
CYBER_DOJO_RUNNER_PORT=4597
CYBER_DOJO_SAVER_PORT=4537
CYBER_DOJO_WEB_PORT=3000
CYBER_DOJO_RUNNER_CLIENT_PORT=9999
9 changes: 6 additions & 3 deletions bin/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ echo_base_image()

echo_env_vars()
{
# Get identities of dependent services from versioner
docker run --rm cyberdojo/versioner
export $(docker run --rm cyberdojo/versioner)
echo "CYBER_DOJO_LANGUAGES_START_POINTS=${CYBER_DOJO_LANGUAGES_START_POINTS_IMAGE}:${CYBER_DOJO_LANGUAGES_START_POINTS_TAG}"

# Set env-vars for the runner service living in this repo
# --build-arg ...
if [[ ! -v CYBER_DOJO_RUNNER_BASE_IMAGE ]] ; then
echo CYBER_DOJO_RUNNER_BASE_IMAGE="$(echo_base_image)"
Expand All @@ -19,9 +25,6 @@ echo_env_vars()
echo COMMIT_SHA="${sha}"
fi

# From versioner ...
docker run --rm cyberdojo/versioner

echo CYBER_DOJO_RUNNER_SHA="${sha}"
echo CYBER_DOJO_RUNNER_TAG="${sha:0:7}"

Expand Down
10 changes: 7 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ services:
ports: [ "${CYBER_DOJO_RUNNER_CLIENT_PORT}:${CYBER_DOJO_RUNNER_CLIENT_PORT}" ]
depends_on: [ server ]
env_file: [ .env ]
environment: [ CONTEXT=client, SHOW_TEST_IDS ]
environment:
- CONTEXT=client
- SHOW_TEST_IDS=false
read_only: true
restart: no
tmpfs: /tmp
Expand All @@ -32,7 +34,9 @@ services:
ports: [ "${CYBER_DOJO_RUNNER_PORT}:${CYBER_DOJO_RUNNER_PORT}" ]
depends_on: [ languages-start-points ]
env_file: [ .env ]
environment: [ CONTEXT=server, SHOW_TEST_IDS ]
environment:
- CONTEXT=server
- SHOW_TEST_IDS=false
read_only: true
restart: no
tmpfs: /tmp
Expand All @@ -41,7 +45,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock

languages-start-points:
image: ${CYBER_DOJO_LANGUAGES_START_POINTS_IMAGE}:${CYBER_DOJO_LANGUAGES_START_POINTS_TAG}
image: ${CYBER_DOJO_LANGUAGES_START_POINTS}
ports: [ "${CYBER_DOJO_LANGUAGES_START_POINTS_PORT}:${CYBER_DOJO_LANGUAGES_START_POINTS_PORT}" ]
user: nobody
env_file: [ .env ]
Expand Down

0 comments on commit da3dbd0

Please sign in to comment.