Compose
The first service we will build is our compose service.
Tip
If any of these apply to you:
- Came in late and need to catch up
- Messed up your files somehow and cannot figure out how to fix them
- Just want skip to the end of this section of the workshop
then run the last command block under the Skip section at the very bottom of this page.
entypoint.sh
First, lets take a look at our entrypoint.sh file.
| entrypoint.sh | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
Solution
| entrypoint.sh.solution | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
To apply the solution file, copy it over your workshop file.
Note: the current contents of your workshop file will be lost.
cp entrypoint.sh{.solution,}
Dockerfile
Next, lets take a look at our Dockerfile file.
| Dockerfile | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
Solution
| Dockerfile.solution | |
|---|---|
1 2 3 4 5 6 7 | |
To apply the solution file, copy it over your workshop file.
Note: the current contents of your workshop file will be lost.
cp Dockerfile{.solution,}
compose.yml
Next, lets take a look at our compose.yml file.
| compose.yml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Solution
| compose.yml.solution | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
To apply the solution file, copy it over your workshop file.
Note: the current contents of your workshop file will be lost.
cp compose.yml{.solution,}
Skip
To skip this whole page, run the following code block:
toplevelrepodir="$(git rev-parse --show-toplevel)" \
&& [[ -n "${toplevelrepodir}" ]] \
&& [[ "${toplevelrepodir}" =~ pipelines-as-a-service ]] \
&& cd "${toplevelrepodir}" \
&& for solutionfile in services/compose/*.solution; do
workshopfile="${solutionfile%.solution}"
git restore "${solutionfile}"
cp "${solutionfile}" "${workshopfile}"
done
Test
Now, we can test our compose service.
toplevelrepodir="$(git rev-parse --show-toplevel)" \
&& [[ -n "${toplevelrepodir}" ]] \
&& [[ "${toplevelrepodir}" =~ pipelines-as-a-service ]] \
&& cd "${toplevelrepodir}" \
&& [[ -f "shellcheckit.env" ]] \
&& docker compose \
-f "dev.overrides.compose.yml" \
-f "compose.yml" \
run \
--rm \
--build \
--remove-orphans \
shellcheckit
If everything is working properly, you should see your compose service use shellcheck to lint a copy of your entryopint.sh.
If it did not work take a little time to troubleshoot, but do not worry too much, the rest of the workshop does not rely on this part working properly on your local machine.
Next, we will build our hooks service.