Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add post-start script #36

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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