Skip to content

Commit

Permalink
upd�e
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Oct 24, 2024
1 parent ddc1aa4 commit 8ee086c
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 9 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:

jobs:
build-and-deploy-microservices:
configure-environment:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout repository
Expand All @@ -28,6 +28,31 @@ jobs:
sudo apt-get install -y python3 python3-pip
pip install pyyaml
build-base-image:
needs: configure-environment
runs-on: ubuntu-latest
steps:
- name: Get base image version
run: |
BASE_VERSION=$(echo ./assets/.BASE_VERSION)
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
echo "Base Version: $BASE_VERSION"
- name: Build base image
run: |
sudo chmod +x ./assets/scripts/build_base.sh
./assets/scripts/build_base.sh ${{ env.BASE_VERSION }}
- name: Push base image to GHCR
run: |
sudo chmod +x ./assets/scripts/push_base.sh
sudo chmod +x ./assets/scripts/push_image.sh
./assets/scripts/push_base.sh ${{ env.BASE_VERSION }} ${{ secrets.REPO_ADMIN_GH_USERNAME }}
get-microservice-versions:
needs: build-base-image
runs-on: ubuntu-latest
steps:
# Step 5: Extract API container version
- name: Extract API container version
id: extract_api_version
Expand All @@ -50,6 +75,10 @@ jobs:
echo "API_VERSION=${{ env.API_VERSION }}"
echo "WORKER_VERSION=${{ env.WORKER_VERSION }}"
build-microservice-images:
needs: get-microservice-versions
runs-on: ubuntu-latest
steps:
# Step 8: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -58,6 +87,10 @@ jobs:
- name: Build Docker containers with Docker Compose
run: docker-compose build --no-cache

deploy-microservice-images:
needs: build-microservice-images
runs-on: ubuntu-latest
steps:
# Step 10: Change permissions for push script
- name: Change push script permissions
run: chmod +x ./assets/scripts/push_image.sh
Expand Down
10 changes: 6 additions & 4 deletions compose_worker/Dockerfile-compose_worker
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ COPY . /app/worker
ENV PATH="/root/.local/bin:$PATH"

# Install only worker deps TODO: include toml in base deps
RUN poetry add toml --group=worker --lock && poetry install --only=worker --no-cache
RUN poetry install --only=worker --no-cache

# Install Assimulo from source for Pysces
RUN apt-get update \
Expand All @@ -71,14 +71,16 @@ RUN apt-get update \
# && rm -rf build \
# && poetry run python3 setup.py install --sundials-home=/usr/local --blas-home=/usr/lib/x86_64-linux-gnu

# install masspy TODO: do this
# RUN poetry run pip install biosimulators-masspy

# revert numpy back to original spec
RUN poetry remove numpy
# RUN poetry run pip install numpy==$(poetry run python3 -c "import toml; print(toml.load('/app/pyproject.toml')['tool']['poetry']['group']['worker']['dependencies']['numpy'].strip('<'))") \
# && poetry lock

# install masspy TODO: implement this
RUN git clone https://github.com/biosimulators/Biosimulators_MASSpy.git \
&& cd Biosimulators_MASSpy \
&& rm pyproject.toml

WORKDIR /app/worker

RUN python3 -c "import os;files=os.listdir();import shutil;[shutil.rmtree(f) if '__pycache__' in f else None for f in files]"
Expand Down
Loading

0 comments on commit 8ee086c

Please sign in to comment.