-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from NASA-IMPACT/feature/post-start-script
add post-start script
- Loading branch information
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
FROM public.ecr.aws/nasa-veda/pangeo-notebook:56cc88560df6cf444d49af7d8f0f7a340d412ce0f10ab441254cb712b9480281 | ||
# above hash is JH version 4.x | ||
ENV VERSION=0.0.1 | ||
# NOTE: the below script is used as a k8s post-start hook to copy /veda-docs repository to all user pods | ||
COPY --chown=jovyan:jovyan ./k8s-lifecycle-hook-post-start.py /opt/k8s-lifecycle-hook-post-start.py | ||
RUN chmod +x /opt/k8s-lifecycle-hook-post-start.py |
15 changes: 15 additions & 0 deletions
15
docker-images/custom/nasa-veda-singleuser/k8s-lifecycle-hook-post-start.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import subprocess | ||
|
||
try: | ||
result = subprocess.run( | ||
["/srv/conda/envs/notebook/bin/gitpuller", "https://github.com/NASA-IMPACT/veda-docs/", "main", "/home/jovyan/veda-doc-examples"], | ||
check=True, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
text=True # Capture output as a string instead of bytes | ||
) | ||
print(f"Command stdout:\n{result.stdout}") | ||
print(f"Command stderr:\n{result.stderr}") | ||
except subprocess.CalledProcessError as e: | ||
print(f"Command failed with error {e.returncode}, stderr:\n{e.stderr}") | ||
raise |