Skip to content

Commit

Permalink
CI Testing multiple projects (not clean) (#130)
Browse files Browse the repository at this point in the history
* updated shared model tests

* [feat] testing multiple projects (not clean)

* [bug] python 3.11 minimum?

* [bug] ./ might be an issue?

* [bug] two extra "

---------

Co-authored-by: Francois <[email protected]>
  • Loading branch information
ctr26 and sherwoodf committed Aug 2, 2024
1 parent 2618a5c commit 562dca4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/.share
**/.git
**/.venv
.venv
2 changes: 1 addition & 1 deletion api/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.cwd": "${workspaceFolder}",
"python.testing.cwd": "${workspaceFolder}/api",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
Expand Down
20 changes: 8 additions & 12 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@ FROM python:3.10.0

EXPOSE 8080


# Override default shell and use bash and bia env
#RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
# /bin/bash ~/miniconda.sh -b -p /opt/conda
#ENV PATH=/opt/conda/bin:$PATH
#RUN conda env create -f conda_env.yml

RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH=/root/.local/bin:$PATH

# add files that poetry needs first so layers up to (including) pulling dependencies get reused
WORKDIR /bia-integrator

# only add poetry.lock if it exists (building on local)
ADD ./poetry.lock* /integrator-api/poetry.lock
ADD ./pyproject.toml /integrator-api/pyproject.toml
WORKDIR /integrator-api
ADD ./api/poetry.lock* api/poetry.lock
ADD ./api/pyproject.toml api/pyproject.toml
ADD ./bia-shared-datamodels bia-shared-datamodels

WORKDIR /bia-integrator/api
RUN poetry install

# Everything up to here should be reused most times

# add the actual project, which is what is often changed in between two different container builds
ADD ./ /integrator-api
ADD ./api ./

CMD ["poetry", "run", "uvicorn", "--workers", "4", "--port", "8080", "--log-config", "./src/log_config.yml", "--host", "0.0.0.0", "src.app:app"]
CMD ["poetry", "run", "uvicorn", "--workers", "4", "--port", "8080", "--log-config", "./src/log_config.yml", "--host", "0.0.0.0", "api.app:app"]
9 changes: 4 additions & 5 deletions api/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ services:
# #- "./.share/keyfile.secret:/home/share/keyfile/keyfile.secret"
bia-integrator-api:
build:
context: .
context: ..
dockerfile: ./api/Dockerfile
env_file: ./.env_compose
container_name: api
hostname: api
ports:
- 8080:8080
expose:
- 8080
volumes:
- "./.env_compose:/integrator-api/.env"
depends_on:
- biaint-mongo


volumes:
api_data:
#? do we always want a 'seed db'?
#external: true
#external: true
2 changes: 2 additions & 0 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ ome-types = "^0.4.2"
xsdata = "23.8"
lxml = "^4.9.3"
json-log-formatter = "^1.0"
#@TODO: CHANGEME
bia-shared-datamodels = { path = "../../prs/bia-integrator/bia-shared-datamodels", develop = true }

[tool.poetry.group.dev.dependencies]
locust = "^2.16.1"
Expand Down

0 comments on commit 562dca4

Please sign in to comment.