From b87d63382af05df6d79fa88c5e0d27a6812c91ef Mon Sep 17 00:00:00 2001 From: Drew Yang Date: Thu, 7 Mar 2024 14:04:14 -0600 Subject: [PATCH] =?UTF-8?q?feat(reusable-workflows):=20=E2=9C=A8=20codeboo?= =?UTF-8?q?k=20profile=20image=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codebook-profile/codebook.Dockerfile | 23 +++++++++++++++++++ .../codebook-profile/docker-compose.yaml | 15 ++++++++++++ .../codebook-profile/example.env | 6 +++++ .gitignore | 6 ++++- 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/docker-template/codebook-profile/codebook.Dockerfile create mode 100644 .github/docker-template/codebook-profile/docker-compose.yaml create mode 100644 .github/docker-template/codebook-profile/example.env diff --git a/.github/docker-template/codebook-profile/codebook.Dockerfile b/.github/docker-template/codebook-profile/codebook.Dockerfile new file mode 100644 index 0000000..4628645 --- /dev/null +++ b/.github/docker-template/codebook-profile/codebook.Dockerfile @@ -0,0 +1,23 @@ +## docker build --build-arg JHUB_VER=4.0.2 --build-arg PY_VER=3.10 --build-arg DEPLOY_KEY=wt-ephys-no-curation-deploy.pem --build-arg REPO_OWNER=dj-sciops --build-arg REPO_NAME=wt-ephys-no-curation -f codebook.Dockerfile -t registry.vathes.com/sciops/codebook-wt-ephys-no-curation:v0.0.0 . + +## Single Stage +ARG JHUB_VER +ARG PY_VER +ARG DIST +FROM datajoint/djlabhub:singleuser-${JHUB_VER}-py${PY_VER} + +ARG DEPLOY_KEY +COPY --chown=jovyan $DEPLOY_KEY $HOME/.ssh/id_ed25519 +RUN chmod 400 $HOME/.ssh/id_ed25519 + +ARG REPO_OWNER +ARG REPO_NAME +WORKDIR /tmp +RUN ssh-keyscan -t ed25519 github.com >> $HOME/.ssh/known_hosts && \ + git clone git@github.com:${REPO_OWNER}/${REPO_NAME}.git && \ + pip install ./${REPO_NAME} && \ + mv ./${REPO_NAME}/* /home/jovyan/ && \ + rm -rf /tmp/${REPO_NAME} && \ + rm -rf $HOME/.ssh/ + +WORKDIR /home/jovyan \ No newline at end of file diff --git a/.github/docker-template/codebook-profile/docker-compose.yaml b/.github/docker-template/codebook-profile/docker-compose.yaml new file mode 100644 index 0000000..1fe089e --- /dev/null +++ b/.github/docker-template/codebook-profile/docker-compose.yaml @@ -0,0 +1,15 @@ +# cd ./docker-template/codebook_env && set -a && source .env && docker-compose -f dist/debian/docker-compose-codebook_env.yaml build +version: '2.4' +services: + codebook_env: + build: + # only necessary if rebuilding image + context: . + dockerfile: codebook.Dockerfile + args: + - JHUB_VER + - PY_VER + - DEPLOY_KEY + - REPO_OWNER + - REPO_NAME + image: registry.vathes.com/sciops/codebook_${REPO_NAME}:singleuser-${JHUB_VER}-py${PY_VER}-${WORKFLOW_VERSION} \ No newline at end of file diff --git a/.github/docker-template/codebook-profile/example.env b/.github/docker-template/codebook-profile/example.env new file mode 100644 index 0000000..81afa83 --- /dev/null +++ b/.github/docker-template/codebook-profile/example.env @@ -0,0 +1,6 @@ +JHUB_VER=4.0.2 +PY_VER=3.10 +DEPLOY_KEY= +REPO_OWNER= +REPO_NAME= +WORKFLOW_VERSION= diff --git a/.gitignore b/.gitignore index 496ee2c..f335be3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -.DS_Store \ No newline at end of file +.DS_Store + +*.pem +*.env +!example.env \ No newline at end of file