Skip to content

Commit

Permalink
Docker: Add folders that automatically run scripts before/after daemo…
Browse files Browse the repository at this point in the history
…n start (#6170)

In order to simplify the implementation of using the `aiida-core` image
as the base for customized images, the `run-before-daemon-start` and
`run-after-daemon-start` script folders are created. Any executables in
these two folders will be executed before and after the AiiDA daemon is
started in the container, respectively.

The standard linux `run-parts` tool is used to scan these folders for
files, which are run in the lexical sort order of their names, according
to the C/POSIX locale character collation rules
  • Loading branch information
unkcpz authored Nov 9, 2023
1 parent a216f50 commit 5fe6f4f
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .docker/aiida-core-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ RUN mkdir -p "${CONDA_DIR}/etc/conda/activate.d" && \
COPY --chown="${SYSTEM_UID}:${SYSTEM_GID}" s6-assets/config-quick-setup.yaml "/aiida/assets/config-quick-setup.yaml"
COPY s6-assets/s6-rc.d /etc/s6-overlay/s6-rc.d
COPY s6-assets/init /etc/init
RUN mkdir /etc/init/run-before-daemon-start && \
mkdir /etc/init/run-after-daemon-start

# Otherwise will stuck on oneshot services
# https://github.com/just-containers/s6-overlay/issues/467
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/command/execlineb -P

with-contenv

foreground { s6-echo "Calling /etc/init/run-after-daemon-start" }
run-parts --regex=".*" /etc/init/run-after-daemon-start/
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/command/execlineb -P

with-contenv

foreground { s6-echo "Calling /etc/init/run-before-daemon-start" }
run-parts --regex=".*" /etc/init/run-before-daemon-start/
Empty file.
Empty file.

0 comments on commit 5fe6f4f

Please sign in to comment.