- The source for the cyberdojo/service-yaml Docker image.
- Prints yaml for specified cyber-dojo services to
stdout
. - Tees
stdin
tostdout
allowing catted yml files to be blended intostdout
. - The
stdout
then becomes pipedstdin
and is consumed bydocker-compose --file -
(rather than from a named yml file). - This design is because
docker-compose
cannot combine named yml files with yml fromstdin
.- So, instead, you must cat the yml files and pipe
stdin
into thedocker run ... cyberdojo/service-yaml
command (see thecat
in the example below).
- So, instead, you must cat the yml files and pipe
- Note that a
docker-compose
command receiving its yaml fromstdin
cannot base relative paths (in volume-mounts) from the directory of the yml file (since there isn't one). Instead it uses the current working directory. Caveat emptor.
Example:
$ cat docker-compose.yml \
| docker run --rm --interactive cyberdojo/service-yaml \
custom-start-points \
exercises-start-points \
languages-start-points \
creator \
selenium \
| tee /tmp/augmented-docker-compose.peek.yml \
| docker-compose \
--file - \
up \
--detach
Here's docker-compose.yml
$ cat docker-compose.yml
version: '3.7'
services:
client:
build:
args: [ COMMIT_SHA, CYBER_DOJO_CREATOR_CLIENT_PORT ]
context: src/client
depends_on:
- selenium
image: cyberdojo/creator-client
...
Here's the generated yml
$ cat /tmp/augmented-docker-compose.peek.yml
version: '3.7'
services:
client:
build:
args: [ COMMIT_SHA, CYBER_DOJO_CREATOR_CLIENT_PORT ]
context: src/client
depends_on:
- selenium
image: cyberdojo/creator-client
...
custom-start-points:
image: ${CYBER_DOJO_CUSTOM_START_POINTS_IMAGE}:${CYBER_DOJO_CUSTOM_START_POINTS_TAG}
ports: [ "${CYBER_DOJO_CUSTOM_START_POINTS_PORT}:${CYBER_DOJO_CUSTOM_START_POINTS_PORT}" ]
read_only: true
restart: "no"
tmpfs: /tmp
user: nobody
exercises-start-points:
image: ${CYBER_DOJO_EXERCISES_START_POINTS_IMAGE}:${CYBER_DOJO_EXERCISES_START_POINTS_TAG}
ports: [ "${CYBER_DOJO_EXERCISES_START_POINTS_PORT}:${CYBER_DOJO_EXERCISES_START_POINTS_PORT}" ]
read_only: true
restart: "no"
tmpfs: /tmp
user: nobody
languages-start-points:
image: ${CYBER_DOJO_LANGUAGES_START_POINTS_IMAGE}:${CYBER_DOJO_LANGUAGES_START_POINTS_TAG}
ports: [ "${CYBER_DOJO_LANGUAGES_START_POINTS_PORT}:${CYBER_DOJO_LANGUAGES_START_POINTS_PORT}" ]
read_only: true
restart: "no"
tmpfs: /tmp
user: nobody
creator:
depends_on:
- custom-start-points
- exercises-start-points
- languages-start-points
- saver
image: ${CYBER_DOJO_CREATOR_IMAGE}:${CYBER_DOJO_CREATOR_TAG}
ports: [ "${CYBER_DOJO_CREATOR_PORT}:${CYBER_DOJO_CREATOR_PORT}" ]
read_only: true
restart: "no"
tmpfs: /tmp
user: nobody
saver:
image: ${CYBER_DOJO_SAVER_IMAGE}:${CYBER_DOJO_SAVER_TAG}
ports: [ "${CYBER_DOJO_SAVER_PORT}:${CYBER_DOJO_SAVER_PORT}" ]
read_only: true
restart: "no"
tmpfs:
- /cyber-dojo:uid=19663,gid=65533
- /tmp:uid=19663,gid=65533
user: saver
selenium:
image: selenium/standalone-firefox
ports: [ "4444:4444" ]