From e41259eb268d47d3a2738628f3a190011348c54c Mon Sep 17 00:00:00 2001 From: bio-boris Date: Mon, 21 Mar 2022 13:50:25 -0500 Subject: [PATCH] Initial Release --- .github/workflows/manual-build.yml | 11 +++++++ .github/workflows/pr_build.yml | 43 +++++++++++++++++++++++++ .github/workflows/release-main.yml | 25 +++++++++++++++ Dockerfile | 50 ++++++++++++++++++++---------- README.md | 8 ++--- biokbase/user-env.sh | 5 +++ requirements.txt | 12 ++++--- 7 files changed, 129 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/manual-build.yml create mode 100644 .github/workflows/pr_build.yml create mode 100644 .github/workflows/release-main.yml create mode 100644 biokbase/user-env.sh diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml new file mode 100644 index 0000000..944f903 --- /dev/null +++ b/.github/workflows/manual-build.yml @@ -0,0 +1,11 @@ +--- +name: Manual Build & Push +on: + workflow_dispatch: +jobs: + build-push: + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}-develop' + tags: br-${{ github.ref_name }} + secrets: inherit diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml new file mode 100644 index 0000000..0fa1c46 --- /dev/null +++ b/.github/workflows/pr_build.yml @@ -0,0 +1,43 @@ +--- +name: Pull Request Build, Tag, & Push +on: + pull_request: + branches: + - develop + - main + - master + types: + - opened + - reopened + - synchronize + - closed +jobs: + build-develop-open: + if: github.base_ref == 'develop' && github.event.pull_request.merged == false + uses: kbase/.github/.github/workflows/reusable_build.yml@main + secrets: inherit + build-develop-merge: + if: github.base_ref == 'develop' && github.event.pull_request.merged == true + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}-develop' + tags: pr-${{ github.event.number }},latest + secrets: inherit + build-main-open: + if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == false + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}' + tags: pr-${{ github.event.number }} + secrets: inherit + build-main-merge: + if: (github.base_ref == 'main' || github.base_ref == 'master') && github.event.pull_request.merged == true + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}' + tags: pr-${{ github.event.number }},latest-rc + secrets: inherit + trivy-scans: + if: (github.base_ref == 'develop' || github.base_ref == 'main' || github.base_ref == 'master' ) && github.event.pull_request.merged == false + uses: kbase/.github/.github/workflows/reusable_trivy-scans.yml@main + secrets: inherit diff --git a/.github/workflows/release-main.yml b/.github/workflows/release-main.yml new file mode 100644 index 0000000..a254678 --- /dev/null +++ b/.github/workflows/release-main.yml @@ -0,0 +1,25 @@ +--- +name: Release - Build & Push Image +on: + release: + branches: + - main + - master + types: [ published ] +jobs: + check-source-branch: + uses: kbase/.github/.github/workflows/reusable_validate-branch.yml@main + with: + build_branch: '${{ github.event.release.target_commitish }}' + validate-release-tag: + needs: check-source-branch + uses: kbase/.github/.github/workflows/reusable_validate-release-tag.yml@main + with: + release_tag: '${{ github.event.release.tag_name }}' + build-push: + needs: validate-release-tag + uses: kbase/.github/.github/workflows/reusable_build-push.yml@main + with: + name: '${{ github.event.repository.name }}' + tags: '${{ github.event.release.tag_name }},latest' + secrets: inherit diff --git a/Dockerfile b/Dockerfile index 16fee1d..7c01c8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,54 @@ FROM ubuntu:20.04 +# Note that these labels need to be manually updated with the actual contents of the image LABEL maintainer="scanon@lbl.gov" LABEL us.kbase.ubuntu="20.04" -LABEL us.kbase.python="3.8.4" -LABEL us.kbase.sdk="1.0.18" +LABEL us.kbase.python="3.9.12" +LABEL us.kbase.sdk="1.2.1" +LABEL us.kbase.sdkcommit="8def489f648a7ff5657d33ed05f41c60f4766e1b" +# Fix KBase Catalog Registration Issue +ENV PIP_PROGRESS_BAR=off + +# Install system dependencies RUN \ apt-get -y update && \ + apt-get -y upgrade && \ export DEBIAN_FRONTEND=noninteractive && \ export TZ=Etc/UTC && \ - apt-get -y install gcc make curl git openjdk-8-jre + apt-get -y install gcc make curl git openjdk-8-jre unzip htop # Copy in the SDK -COPY --from=kbase/kb-sdk:20180808 /src /sdk +COPY --from=kbase/kb-sdk:1.2.1 /src /sdk RUN sed -i 's|/src|/sdk|g' /sdk/bin/* + +# Install Conda version py39_4.12.0 and Python 3.9.12 +ENV CONDA_VERSION=py39_4.12.0 +ENV CONDA_INSTALL_DIR=/opt/conda/py39_4.12.0 + RUN \ - V=py38_4.10.3 && \ - curl -o conda.sh -s https://repo.anaconda.com/miniconda/Miniconda3-${V}-Linux-x86_64.sh && \ - sh ./conda.sh -b -p /opt/conda3 && \ + echo "Installing to ${CONDA_INSTALL_DIR}" && \ + curl -o conda.sh -s https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh && \ + sh ./conda.sh -b -p ${CONDA_INSTALL_DIR} && \ rm conda.sh -ENV PATH=/opt/conda3/bin:$PATH:/sdk/bin +# Add in some legacy modules -# Install packages including mamba -RUN \ - conda install -c conda-forge mamba +ADD biokbase $CONDA_INSTALL_DIR/lib/biokbase +ADD biokbase/user-env.sh /kb/deployment/user-env.sh +ADD requirements.txt /tmp/requirements.txt -ADD ./requirements.txt /tmp/ -RUN \ - pip install -r /tmp/requirements.txt +ENV PATH=$CONDA_INSTALL_DIR/bin:/sdk/bin:$PATH +run env -# Add in some legacy modules -ADD biokbase /opt/conda3/lib/python3.8/site-packages/biokbase +# Configure Conda and Install Mamba +RUN \ + conda config --add channels conda-forge && \ + conda config --set channel_priority strict && \ + conda install -y mamba=0.15.3 +#Install packages required for base image +RUN \ + which pip && \ + pip install -r /tmp/requirements.txt diff --git a/README.md b/README.md index 68d89d0..b282f04 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SDK Base Python Image -This is a very minimal base python image for building KBase SDK apps. +This is a very minimal base python image for building KBase SDK apps. It also contains a copy of the KBase SDK. ## Contents @@ -9,7 +9,7 @@ This image just contains the basics. * Ubuntu 20.04 base image * Dependencies packages: gcc make curl git openjdk-8-jre -* Installation of the kb-sdk tool (1.0.18) -* Python 3.8 via Conda +* Installation of the kb-sdk tool (1.2.1) +* Python 3.9.13 via Conda * Mamba for Conda package installation -* A select set of python modules +* A select set of python modules in the requirements.txt diff --git a/biokbase/user-env.sh b/biokbase/user-env.sh new file mode 100644 index 0000000..97dd333 --- /dev/null +++ b/biokbase/user-env.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# In order to avoid `./scripts/entrypoint.sh: line 3: /kb/deployment/user-env.sh: No such file or directory` +# This file is now here +echo "user-env.sh is ignored" diff --git a/requirements.txt b/requirements.txt index 5027e83..8dbc1e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,7 @@ -requests -coverage -nose -sphinx -jsonrpcbase +requests==2.27.1 +coverage==6.3.3 +nose==1.3.7 +sphinx==4.5.0 +jsonrpcbase==0.2.0 +pytest==7.1.1 +pytest-cov==3.0.0