Skip to content

Commit

Permalink
refactor new base and api version
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Nov 6, 2024
1 parent 6933742 commit 2b9cd2d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 28 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/deploy-microservices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,25 @@ jobs:
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version # Check if Docker Compose is installed correctly
- name: Build API microservice image
run: docker-compose build api

- name: Build worker microservice image
run: docker-compose build worker

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

- name: Build API microservice image
run: docker-compose build api

- name: Deploy API microservice container to GHCR
run: |
rm api/spec/openapi_3_1_0_generated.yaml
python3 api/openapi_spec.py
sudo rm -r api/__pycache__
./assets/docker/scripts/push_image.sh api ${{ env.API_VERSION }}
# STABLE CONTENT:
# - run: |
# rm compose_api/spec/openapi_3_1_0_generated.yaml
# python3 compose_api/openapi_spec.py
# sudo rm -r compose_api/__pycache__
# ./docker/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: Build worker microservice image
run: docker-compose build worker

- name: Deploy worker microservice container to GHCR
run: |
sudo rm -r compose_api/__pycache__
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile-base
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# FROM ubuntu:22.04
FROM continuumio/miniconda3:latest

LABEL org.opencontainers.image.title="bio-check-base" \
LABEL org.opencontainers.image.title="bio-compose-server-base" \
org.opencontainers.image.description="Base Docker image for BioCompose REST API management, job processing, and datastorage with MongoDB, ensuring scalable and robust performance." \
org.opencontainers.image.url="https://biosimulators.org/" \
org.opencontainers.image.source="https://github.com/biosimulators/bio-check" \
org.opencontainers.image.authors="Alexander Patrie <[email protected]>, BioSimulators Team <[email protected]>" \
org.opencontainers.image.vendor="BioSimulators Team"

# SHELL ["/bin/bash", "-c"]
SHELL ["/usr/bin/env", "bash", "-c"]

# shared env
Expand All @@ -32,7 +31,10 @@ RUN mkdir -p /Pysces \
&& mkdir -p /root/Pysces \
&& mkdir -p /root/Pysces/psc \
&& conda env create -n server -f environment.base.yml -y \
&& echo "conda activate server" >> ~/.bashrc
&& echo "conda activate server" >> ~/.bashrc \
&& source ~/.bashrc \
&& conda env export --no-builds > config/environment.base.lock.yml \
&& rm -f environment.base.yml


# # create conda env from yml and ensure env activation
Expand Down
6 changes: 4 additions & 2 deletions api/Dockerfile-api
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ EXPOSE 3001

RUN source ~/.bashrc \
&& conda env update -n server -f config/environment.api.yml \
&& conda run pip install -e . \
&& conda clean --all --json -y
&& conda run pip install -e . --root-user-action=ignore \
&& conda env export --no-builds > config/environment.api.lock.yml \
&& conda clean --all --json -y \
&& rm -f config/environment.api.yml

# RUN source ~/.bashrc \
# && poetry install --without=composition,dev,worker --no-cache
Expand Down
2 changes: 1 addition & 1 deletion assets/docker/.BASE_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.4-test
0.0.5-test
16 changes: 6 additions & 10 deletions worker/Dockerfile-worker
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ FROM ghcr.io/biosimulators/bio-compose-server-base:latest
SHELL ["/usr/bin/env", "bash", "-c"]

COPY ./ .
# COPY ../assets/docker/config/environment.base.yml ../assets/docker/config/environment.worker.yml .

ENV TEST_SBML_FP="test_fixtures/Elowitz-Nature-2000-Repressilator/BIOMD0000000012_url.xml" \
TEST_PSC_FP="/Pysces/psc/BIOMD0000000012_url.xml.psc" \
Expand Down Expand Up @@ -46,20 +45,17 @@ RUN source ~/.bashrc \
libboost-math-dev \
libboost-serialization-dev \
&& conda env update -n server -f config/environment.worker.yml \
&& conda run pip install -e . \
&& conda run pip install -e . --root-user-action=ignore \
&& conda env export --no-builds > config/environment.worker.lock.yml \
&& conda clean --all --json -y \
&& rm -f config/environment.worker.yml \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoremove -y \
&& apt-get clean \
&& conda clean --all --json -y
&& apt-get clean

# && conda install -c conda-forge -c pysces pysces \
# && conda env update -n server -f config/environment.worker.yml \
# && conda install "numpy<1.22.0" \
# && conda run pip install amici biosimulators-amici --root-user-action=ignore \
# && rm -rf config \
ENTRYPOINT ["bash", "-c", "source ~/.bashrc && conda run python3 main.py"]

# --root-user-action=ignore

#############################
# Fenics installation

Expand Down

0 comments on commit 2b9cd2d

Please sign in to comment.