diff --git a/Dockerfile b/Dockerfile index 54dd2202..9332d623 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ # ------------------------------------------------------------------------------------- # Container to serve FastAPI backend api from sbmlutils +# sudo docker build -t fastapi-app . +# sudo docker run -p 1444:1444 fastapi-app # ------------------------------------------------------------------------------------- -FROM python:3.12 +FROM python:3.12-slim # Add application code to the image COPY ./src /code/src @@ -16,9 +18,5 @@ 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 1444 CMD ["uvicorn", "sbmlutils.report.api:api", "--host", "0.0.0.0", "--port", "1444"] diff --git a/Dockerfile_old b/Dockerfile_old deleted file mode 100644 index 2b32f9b3..00000000 --- a/Dockerfile_old +++ /dev/null @@ -1,43 +0,0 @@ -# ------------------------------------------------------------------------------------- -# 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"] diff --git a/docker-compose-develop.yml b/docker-compose-develop.yml index 574cbd71..6bdd7d3b 100644 --- a/docker-compose-develop.yml +++ b/docker-compose-develop.yml @@ -3,11 +3,11 @@ # ----------------------------------------------------------------------------- # # build containers -# docker compose -f docker-compose-develop.yml build --no-cache -# docker compose -f docker-compose-develop.yml build +# sudo docker compose -f docker-compose-develop.yml build --no-cache +# sudo 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 +# sudo docker compose -f docker-compose-develop.yml up --detach +# sudo docker compose -f docker-compose-develop.yml up # ----------------------------------------------------------------------------- version: '3' @@ -25,10 +25,9 @@ services: volumes: - .:/code expose: - - "80" + - "1444" ports: - - "1444:80" - # command: ["/start.sh"] + - "1444:1444" frontend: restart: always diff --git a/docker-compose-production.yml b/docker-compose-production.yml index 41ec5585..64746d2f 100644 --- a/docker-compose-production.yml +++ b/docker-compose-production.yml @@ -2,11 +2,11 @@ # DOCKER COMPOSE DEPLOYMENT # ----------------------------------------------------------------------------- # build containers -# docker-compose -f docker-compose-production.yml build --no-cache -# docker-compose -f docker-compose-production.yml build +# sudo docker-compose -f docker-compose-production.yml build --no-cache +# sudo docker-compose -f docker-compose-production.yml build # serve containers -# docker-compose -f docker-compose-production.yml up -# docker-compose -f docker-compose-production.yml up --detach +# sudo docker-compose -f docker-compose-production.yml up +# sudo docker-compose -f docker-compose-production.yml up --detach # ----------------------------------------------------------------------------- version: '3' @@ -26,9 +26,7 @@ services: expose: - "1444" ports: - # - "1444:80" - "1444:1444" - command: ["/start.sh"] frontend: environment: