-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from nimh-dsst/docker-speedup
Docker speedup
- Loading branch information
Showing
11 changed files
with
119 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
*/.terraform | ||
**/.terraform | ||
tempdata/* | ||
.venv | ||
.DS_Store | ||
.env | ||
.gitattributes | ||
.github | ||
.gitignore | ||
.pre-commit-config.yaml | ||
.public_dns | ||
.pytest_cache | ||
.ruff_cache | ||
LICENSE | ||
README.md | ||
build | ||
draft_of_specification_2024-05-06.md | ||
*.egg-info | ||
osm_output | ||
scripts | ||
tests | ||
uv.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
FROM tiangolo/uvicorn-gunicorn:python3.11 | ||
|
||
SHELL ["/bin/bash", "--login", "-c"] | ||
COPY --from=ghcr.io/astral-sh/uv:0.4.0 /uv /bin/uv | ||
WORKDIR /app | ||
RUN mkdir -p /opt/data | ||
RUN mkdir -p /opt/osm | ||
|
||
RUN pip install poetry fastapi[standard] uvicorn | ||
RUN mkdir -p /opt/osm/osm | ||
ENV UV_SYSTEM_PYTHON=1 | ||
# ENV UV_PYTHON=/usr/local/bin/python | ||
# Install requirements first in a separate layer to avoid re-installing them on | ||
# every code changes | ||
COPY pyproject.toml /opt/osm | ||
RUN bash -c 'FORCE_OSM_VERSION=0.0.0 pip install -r <(poetry export --without-hashes --format=requirements.txt)' | ||
# Install the package | ||
COPY osm /opt/osm/osm | ||
RUN --mount=source=.git,target=/opt/osm/.git,type=bind pip install --no-dependencies -e /opt/osm | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OSM=9.9.9; \ | ||
cd /opt/osm; \ | ||
uv pip install --system -r <(uv pip compile --all-extras pyproject.toml ) | ||
COPY ./osm /opt/osm/osm | ||
RUN --mount=source=.git,target=/opt/osm/.git,type=bind \ | ||
--mount=type=cache,target=/root/.cache/uv \ | ||
cd /opt/osm; \ | ||
uv pip install --system -r <(uv pip compile --all-extras pyproject.toml ) -e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,78 @@ | ||
name: local-osm | ||
services: | ||
base_image: | ||
image: nimhdsst/osm_base | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.base | ||
|
||
rtransparent: | ||
container_name: rtransparent | ||
build: | ||
context: . | ||
dockerfile: ./external_components/rtransparent/Dockerfile | ||
volumes: | ||
- ./external_components/rtransparent:/app | ||
|
||
llm_extraction: | ||
image: nimhdsst/osm_base | ||
environment: | ||
- OPENAI_API_KEY=${OPENAI_API_KEY:-NOKEY} | ||
build: | ||
context: . | ||
dockerfile: ./external_components/llm_extraction/Dockerfile | ||
volumes: | ||
- ./external_components/llm_extraction:/app | ||
depends_on: | ||
- base_image | ||
|
||
|
||
############ Development images ############ | ||
|
||
web_api: | ||
image: nimhdsst/osm_base | ||
container_name: web_api | ||
db: | ||
# use old version of mongo to avoid Apple Instruction set error | ||
image: mongo:4.4.6 | ||
container_name: db | ||
ports: | ||
- 27017:27017 | ||
environment: | ||
- MONGODB_URI=mongodb://db:27017/osm | ||
- MONGO_INITDB_DATABASE=osm | ||
|
||
base: | ||
command: ["echo", "base image"] | ||
image: nimhdsst/osm_base:latest | ||
build: | ||
context: . | ||
dockerfile: ./web/api/Dockerfile | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- ./web/api:/app/app | ||
- ./osm:/opt/osm/osm | ||
working_dir: /app/app | ||
command: ["fastapi","dev","--host","0.0.0.0","--port","80"] | ||
depends_on: | ||
- db | ||
- base_image | ||
dockerfile: Dockerfile.base | ||
|
||
dashboard: | ||
image: nimhdsst/osm_base | ||
container_name: dashboard | ||
environment: | ||
- MONGODB_URI=mongodb://db:27017/osm | ||
image: nimhdsst/osm_dashboard:latest | ||
build: | ||
context: . | ||
dockerfile: ./web/dashboard/Dockerfile | ||
ports: | ||
- "8501:8501" | ||
volumes: | ||
- ./web/dashboard:/app | ||
- ./osm:/opt/osm/osm | ||
working_dir: /app | ||
command: ["python", "app.py"] | ||
- ./dashboard_data:/opt/data | ||
depends_on: | ||
- db | ||
- base_image | ||
- base | ||
develop: | ||
watch: | ||
- action: sync+restart | ||
path: ./osm | ||
target: /opt/osm/osm | ||
ignore: | ||
- __pycache__ | ||
|
||
db: | ||
container_name: db | ||
# use old version of mongo to avoid Apple Instruction set error | ||
image: mongo:4.4.6 | ||
ports: | ||
- 27017:27017 | ||
web_api: | ||
container_name: web_api | ||
working_dir: /app/app | ||
command: ["fastapi","dev","--host","0.0.0.0","--port","80"] | ||
environment: | ||
- MONGO_INITDB_DATABASE=osm | ||
- MONGODB_URI=mongodb://db:27017/osm | ||
image: nimhdsst/osm_web_api:latest | ||
build: | ||
context: . | ||
dockerfile: ./web/api/Dockerfile | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- ./web/api:/app/app | ||
depends_on: | ||
- db | ||
- base | ||
develop: | ||
watch: | ||
- action: sync+restart | ||
path: ./osm | ||
target: /opt/osm/osm | ||
ignore: | ||
- __pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
FROM nimhdsst/osm_base | ||
RUN pip install llama-index llama-index-llms-openai llama-index-program-openai | ||
|
||
# # Copy the project files and install the package | ||
COPY external_components/llm_extraction/app.py /app | ||
|
||
# Install the package | ||
COPY osm /opt/osm/osm | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OSM=9.9.9; \ | ||
cd /opt/osm ; uv pip install -e . | ||
CMD ["fastapi", "dev", "--host", "0.0.0.0", "--port", "8072"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
FROM nimhdsst/osm_base | ||
|
||
COPY ./web/api/main.py /app/app/main.py | ||
|
||
CMD ["fastapi", "run", "--host", "0.0.0.0", "--port", "80", "--root-path", "/api"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
|
||
FROM nimhdsst/osm_base | ||
RUN pip install colorcet panel | ||
# # Copy the project files and install the package | ||
COPY web/dashboard/ /app | ||
ENV LOCAL_DATA_PATH=/opt/data/matches.parquet | ||
CMD ["python", "app.py"] | ||
|
||
|
||
# # Create the environment | ||
# RUN pip install panel pymongo odmantic pandas pydantic[email] pyarrow | ||
|
||
# ENV LOCAL_DATA_PATH=/opt/data/matches.parquet | ||
# COPY ./tempdata/matches.parquet /opt/data/matches.parquet |