Skip to content

Commit

Permalink
working on new docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskoenig committed Aug 14, 2024
1 parent d87f2b8 commit 487615d
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 44 deletions.
31 changes: 6 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
# -------------------------------------------------------------------------------------
# Container to serve FastAPI backend api from sbmlutils
# -------------------------------------------------------------------------------------
# https://fastapi.tiangolo.com/deployment/docker/
# see https://github.com/tiangolo/uvicorn-gunicorn-docker for env variables
FROM python:3.12

# build image
# docker build -t myimage .

# start container
# docker run -d --name mycontainer -p 80:80 -e MODULE_NAME="sbmlutils.report.api" -e VARIABLE_NAME="api" myimage
# docker run -d --name mycontainer -p 80:80 myimage
# -------------------------------------------------------------------------------------
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11

# Caching of python requirements
# COPY ./requirements.txt /code/requirements.txt
# CMD pip install --requirement /code/requirements.txt

# Adds application code to the image
# COPY . /code
# Add application code to the image
COPY ./src /code/src
COPY ./setup.cfg /code/setup.cfg
COPY ./setup.py /code/setup.py
Expand All @@ -31,13 +16,9 @@ WORKDIR /code
# Install sbmlutils
RUN pip install -e . --no-cache-dir --upgrade

ENV MODULE_NAME="sbmlutils.report.api"
ENV VARIABLE_NAME="api"
ENV PORT="1444"
#ENV MODULE_NAME="sbmlutils.report.api"
#ENV VARIABLE_NAME="api"
#ENV PORT="1444"

# EXPOSE 80
EXPOSE 1444

# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations)
# And then will start Gunicorn with Uvicorn
CMD ["/start.sh"]
CMD ["uvicorn", "sbmlutils.report.api:api", "--host", "0.0.0.0", "--port", "1444"]
43 changes: 43 additions & 0 deletions Dockerfile_old
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -------------------------------------------------------------------------------------
# Container to serve FastAPI backend api from sbmlutils
# -------------------------------------------------------------------------------------
# https://fastapi.tiangolo.com/deployment/docker/
# see https://github.com/tiangolo/uvicorn-gunicorn-docker for env variables

# build image
# docker build -t myimage .

# start container
# docker run -d --name mycontainer -p 80:80 -e MODULE_NAME="sbmlutils.report.api" -e VARIABLE_NAME="api" myimage
# docker run -d --name mycontainer -p 80:80 myimage
# -------------------------------------------------------------------------------------
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11

# Caching of python requirements
# COPY ./requirements.txt /code/requirements.txt
# CMD pip install --requirement /code/requirements.txt

# Adds application code to the image
# COPY . /code
COPY ./src /code/src
COPY ./setup.cfg /code/setup.cfg
COPY ./setup.py /code/setup.py
COPY ./README.rst /code/README.rst
COPY ./MANIFEST.in /code/MANIFEST.in
COPY ./LICENSE /code/LICENSE

WORKDIR /code

# Install sbmlutils
RUN pip install -e . --no-cache-dir --upgrade

ENV MODULE_NAME="sbmlutils.report.api"
ENV VARIABLE_NAME="api"
ENV PORT="1444"

# EXPOSE 80
EXPOSE 1444

# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations)
# And then will start Gunicorn with Uvicorn
CMD ["/start.sh"]
4 changes: 0 additions & 4 deletions deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,3 @@ Pull latest changes
```
./deploy.sh
```




11 changes: 5 additions & 6 deletions docker-compose-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
# -----------------------------------------------------------------------------
#
# build containers
# docker-compose -f docker-compose-develop.yml build --no-cache
# docker-compose -f docker-compose-develop.yml build
# docker compose -f docker-compose-develop.yml build --no-cache
# docker compose -f docker-compose-develop.yml build
# serve containers
# docker-compose -f docker-compose-develop.yml up --detach
# docker-compose -f docker-compose-develop.yml up
# docker compose -f docker-compose-develop.yml up --detach
# docker compose -f docker-compose-develop.yml up
# -----------------------------------------------------------------------------

version: '3'

volumes:
Expand All @@ -29,7 +28,7 @@ services:
- "80"
ports:
- "1444:80"
command: ["/start.sh"]
# command: ["/start.sh"]

frontend:
restart: always
Expand Down
1 change: 0 additions & 1 deletion misc/xpp/xpp_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def simulate(sbml_file):

if __name__ == "__main__":


# download and unzip all sbml files
# ode_all = get_models(download=True)

Expand Down
16 changes: 8 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,21 @@ install_requires =
numpy>=1.26.4
python-libsbml>=5.20.4
antimony>=2.15.0

scipy>=1.14
pandas>=2.2.0
tabulate>=0.9.0
pint>=0.24.3
tabulate>=0.9.0
beautifulsoup4>=4.12.3

markdown-it-py>=3.0.0
openpyxl>=3.1.5
xmlschema>=3.3.2
uvicorn>=0.30.6
matplotlib>=3.9
py4cytoscape>=1.9.0
libroadrunner>=1.26.4
libroadrunner>=1.27.0

uvicorn>=0.30.6
fastapi>=0.112.0
python-multipart>=0.0.9
tests_require =
tox>=3.24.3
pytest>=7.0.1
Expand All @@ -90,9 +92,6 @@ test = pytest
where = src

[options.extras_require]
sbml4humans =
fastapi>=0.112.0
python-multipart>=0.0.9
development =
pip-tools>=7.4.1
black>=24.8.0
Expand All @@ -104,6 +103,7 @@ development =
mypy>=1.4.1
pytest>=7.4.0
pytest-cov>=4.1.0
beautifulsoup4>=4.12.3
docs =
sphinx>=3.4.3
ipykernel>=5.4.3
Expand Down

0 comments on commit 487615d

Please sign in to comment.