Skip to content

Commit

Permalink
update to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Oct 30, 2024
1 parent 9965267 commit 7e0bcd0
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 58 deletions.
81 changes: 80 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,83 @@ jobs:
- name: Deploy new latest base version
run: |
docker tag ${{ env.BASE_IMG }}:${{ env.BASE_VERSION }} ${{ env.BASE_IMG }}:latest
docker push ${{ env.BASE_IMG }}:latest
docker push ${{ env.BASE_IMG }}:latest
get-microservice-versions:
needs: deploy-base-image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

# Step 5: Extract API container version
- name: Extract API container version
id: extract_api_version
run: |
API_VERSION=$(python3 .github/parse_container_version.py api)
echo "API_VERSION=$API_VERSION" >> $GITHUB_ENV
echo "API Version: $API_VERSION"
# Step 6: Extract worker container version
- name: Extract worker container version
id: extract_worker_version
run: |
WORKER_VERSION=$(python3 .github/parse_container_version.py worker)
echo "WORKER_VERSION=$WORKER_VERSION" >> $GITHUB_ENV
echo "WORKER Version: $WORKER_VERSION"
# Step 7: Debug output of extracted versions
- name: Debug output of extracted versions
run: |
echo "API_VERSION=${{ env.API_VERSION }}"
echo "WORKER_VERSION=${{ env.WORKER_VERSION }}"
build-microservice-images:
needs: get-microservice-versions
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r assets/configs/requirements.github.txt
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check if Docker Compose is installed correctly
- name: Build Docker containers with Docker Compose
run: docker-compose build --no-cache

- name: Authorize push script
run: chmod +x ./assets/scripts/push_image.sh

- name: Deploy API microservice container to GHCR
run: |
rm compose_api/spec/openapi_3_1_0_generated.yaml
python3 compose_api/openapi_spec.py
sudo rm -r compose_api/__pycache__
./assets/scripts/push_image.sh compose_api ${{ env.API_VERSION }}
env:
REPO_ADMIN_GH_USERNAME: ${{ secrets.REPO_ADMIN_GH_USERNAME }}
REPO_ADMIN_GHCR_TOKEN: ${{ secrets.REPO_ADMIN_GHCR_TOKEN }}

- name: Deploy worker microservice container to GHCR
run: |
sudo rm -r compose_api/__pycache__
./assets/scripts/push_image.sh compose_worker ${{ env.WORKER_VERSION }}
env:
REPO_ADMIN_GH_USERNAME: ${{ secrets.REPO_ADMIN_GH_USERNAME }}
REPO_ADMIN_GHCR_TOKEN: ${{ secrets.REPO_ADMIN_GHCR_TOKEN }}
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check if Docker Compose is installed correctly
- name: Get base image version
- name: Get new base image version
run: |
BASE_VERSION=$(cat ./assets/.BASE_VERSION)
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
Expand All @@ -30,11 +30,6 @@ jobs:
env:
BIOSIMULATIONS_GCLOUD_CONFIG: ${{ secrets.BIO_JSON_CONTENT }}

- name: Get new base tag
run: |
BASE_IMG=ghcr.io/biosimulators/bio-check-base
echo "BASE_IMG=$BASE_IMG" >> $GITHUB_ENV
- name: Test build base image
run: |
docker build --no-cache -f ./Dockerfile-base -t ${{ env.BASE_IMG }}:${{ env.BASE_VERSION }} .
44 changes: 1 addition & 43 deletions Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -70,52 +70,10 @@ COPY ./model-examples/sbml-core/Elowitz-Nature-2000-Repressilator /app/data/Elow
# create readme for poetry
RUN echo "BioCompose Server" > /app/README.md

# install poetry and deps
# install poetry deps
RUN python3.10 -m pip install --upgrade pip \
&& python3.10 -m pip install poetry \
&& poetry config virtualenvs.in-project true \
&& poetry env use 3.10 \
&& poetry install --without=api,worker


# install smoldyn
# RUN . /app/.venv/bin/activate \
# && wget https://www.smoldyn.org/smoldyn-2.73.tgz \
# && tar -xzf smoldyn-2.73.tgz \
# && cd smoldyn-2.73 \
# && cd build \
# && cmake .. -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=$(which python3.10) \
# && make \
# && make install
# && rm -rf /var/lib/apt/lists/* \
# && apt-get clean \
# && apt-get autoclean

# RUN . /app/.venv/bin/activate \
# && curl -O https://download.opensuse.org/repositories/home:/dilawar/xUbuntu_22.04/amd64/smoldyn_2.64.4-1+2.1_amd64.deb \
# && dpkg -i smoldyn_2.64.4-1+2.1_amd64.deb

# RUN . /app/.venv/bin/activate \
# && echo 'deb http://download.opensuse.org/repositories/home:/dilawar/xUbuntu_22.04/ /' | tee /etc/apt/sources.list.d/home:dilawar.list \
# && curl -fsSL https://download.opensuse.org/repositories/home:dilawar/xUbuntu_22.04/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home_dilawar.gpg > /dev/null \
# && apt update \
# && apt install smoldyn

# fix python version constraint, lock env, and check compatible
# RUN sed -i 's/python = ">=3.10"/python = "^3.10"/' /app/pyproject.toml \
# && poetry lock \
# && poetry check

# TODO: fix this eventually, but for now (10/2024) biosimulators-processes is not used
# RUN rm -r biosimulator_processes

# remove existing cobra installation TODO: clean this up
# RUN poetry remove cobra && poetry remove zarr

# install project deps (shared)
# RUN chmod +x /app/assets/install_deps.sh \
# && /app/assets/install_deps.sh /app/assets/requirements.base.txt


# TODO: create shared tooling module which is a set of the sum of api and worker data_model.py & shared.py
# COPY ./assets/shared.py /app/shared.py
11 changes: 3 additions & 8 deletions assets/configs/requirements.github.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
requests-toolbelt~=1.0.0
seaborn~=0.13.2
pydantic~=2.8.2
numpy
pandas
pytest
tellurium
python-dotenv
python-dotenv
fastapi
yaml

0 comments on commit 7e0bcd0

Please sign in to comment.