This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #80 from NERSC/20-09
20 09
- Loading branch information
Showing
9 changed files
with
241 additions
and
30 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
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,14 @@ | ||
ARG branch=unknown | ||
|
||
FROM registry.spin.nersc.gov/das/jupyter-base-${branch}:latest | ||
LABEL maintainer="Rollin Thomas <[email protected]>" | ||
|
||
RUN \ | ||
pip install --no-cache-dir jupyterhub-idle-culler | ||
|
||
WORKDIR /srv | ||
|
||
ADD docker-entrypoint.sh ./ | ||
RUN chmod +x docker-entrypoint.sh | ||
ENTRYPOINT ["./docker-entrypoint.sh"] | ||
CMD ["python3", "-m", "jupyterhub_idle_culler", "--timeout=57600", "--cull-every=3600", "--url=http://web-jupyterhub:8081/hub/api"] |
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,28 @@ | ||
#!/bin/bash | ||
|
||
imcmd="" | ||
for command in docker podman; do | ||
if [ $(command -v $command) ]; then | ||
imcmd=$command | ||
break | ||
fi | ||
done | ||
if [ -n "$imcmd" ]; then | ||
echo "Using $imcmd" | ||
else | ||
echo "No image command defined" | ||
exit 1 | ||
fi | ||
|
||
format="" | ||
if [ "$imcmd" == "podman" ]; then | ||
format="--format docker" | ||
fi | ||
|
||
branch=$(git symbolic-ref --short HEAD) | ||
|
||
$imcmd build \ | ||
--build-arg branch=$branch \ | ||
$format \ | ||
"$@" \ | ||
--tag registry.spin.nersc.gov/das/app-idle-culler.jupyter-nersc-$branch:latest . |
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,28 @@ | ||
#!/bin/bash | ||
|
||
# file_env VAR [DEFAULT] | ||
# ---------------------- | ||
# Treat the value of VAR_FILE as the path to a secrets file and initialize VAR | ||
# with the contents of that file. From postgres docker-entrypoint.sh. | ||
|
||
file_env() { | ||
local var="$1" | ||
local fileVar="${var}_FILE" | ||
local def="${2:-}" | ||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then | ||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)" | ||
exit 1 | ||
fi | ||
local val="$def" | ||
if [ "${!var:-}" ]; then | ||
val="${!var}" | ||
elif [ "${!fileVar:-}" ]; then | ||
val="$(< "${!fileVar}")" | ||
fi | ||
export "$var"="$val" | ||
unset "$fileVar" | ||
} | ||
|
||
file_env 'JUPYTERHUB_API_TOKEN' | ||
|
||
exec "$@" |
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
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
Oops, something went wrong.