File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ setup_rootless_docker
52
52
53
53
philomena init
54
54
55
- step npm ci install --ignore-scripts
55
+ step npm ci --ignore-scripts
56
56
57
57
# Create an empty file which indicates to the healthcheck that the container
58
58
# finished initializing. This precents race conditions with `docker exec` commands
Original file line number Diff line number Diff line change @@ -130,8 +130,11 @@ ENTRYPOINT ["./.devcontainer/init-container.sh"]
130
130
# Check for the presence of a special marker file that indicates that the
131
131
# container has been initialized. Use a big `--interval` to "disable"
132
132
# healthchecks after initialization completes.
133
- HEALTHCHECK --start-period=10s --start-interval=0.5s --interval=9999h \
134
- CMD [ "test" , "-f" , "$HOME/.initialized" ]
133
+ #
134
+ # Also, don't be fooled - docker dosn't interpolate env vars in the CMD exec
135
+ # form, so we explicitly use `bash -c` to expand the `$HOME` variable.
136
+ HEALTHCHECK --start-period=10s --start-interval=0.5s --retries=1 --interval=9999h \
137
+ CMD [ "bash" , "-c" , "test -f $HOME/.initialized" ]
135
138
136
139
# Make sure the process doesn't exit to keep the container alive
137
140
CMD ["sleep" , "infinity" ]
Original file line number Diff line number Diff line change @@ -118,19 +118,23 @@ function devcontainer_up {
118
118
local status=$?
119
119
set -e
120
120
121
+ # Ideally compose should stream the logs from the container while it's
122
+ # starting, unfortunately, this issue has been open for years:
123
+ # https://github.com/docker/compose/issues/9122
121
124
if [[ " $status " = " 0" ]]; then
122
- return 0
125
+ info " Dumping the devcontainer logs..."
126
+ else
127
+ error " Failed to create the devcontainer. Dumping its logs below..."
123
128
fi
124
129
125
- error " Failed to create the devcontainer. Dumping its logs below..."
126
130
step docker compose --file " $file " logs --no-log-prefix
127
131
128
132
return " $status "
129
133
}
130
134
131
135
function devcontainer_forward {
132
136
# Make sure the devcontainer is up and running.
133
- if ! docker ps --all --format ' {{.Names}}' | grep -wq philomena-devcontainer; then
137
+ if ! docker ps --filter " health=healthy " --format ' {{.Names}}' | grep -wq philomena-devcontainer; then
134
138
devcontainer_up
135
139
fi
136
140
You can’t perform that action at this time.
0 commit comments