Skip to content

Commit

Permalink
Merge pull request #36 from NASA-IMPACT/feature/post-start-script
Browse files Browse the repository at this point in the history
add post-start script
  • Loading branch information
ranchodeluxe committed Sep 8, 2023
2 parents 971ce16 + 7f296ef commit 3b9f057
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker-images/custom/nasa-veda-singleuser/Dockerfile
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
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

0 comments on commit 3b9f057

Please sign in to comment.