-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
873 additions
and
1,183 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 |
---|---|---|
|
@@ -3,9 +3,7 @@ | |
|
||
# except | ||
!wort/ | ||
!Pipfile.lock | ||
!Pipfile | ||
!requirements.txt | ||
!pixi.lock | ||
!config/ | ||
!wortapp.py | ||
!pyproject.toml |
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,3 +1,6 @@ | ||
#use flake | ||
# | ||
load_prefix ~/.pixi | ||
|
||
#use flake | ||
watch_file pixi.lock | ||
eval "$(pixi shell-hook)" |
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,89 +1,69 @@ | ||
# Build decoct | ||
FROM rust:1-slim-bullseye as builder | ||
RUN cargo install --git https://github.com/luizirber/decoct --rev 630f5a773e6df22a33dafc3d744e39735c055328 | ||
FROM ghcr.io/prefix-dev/pixi:0.26.1 AS build | ||
|
||
# Build worker image | ||
FROM python:3.10.9-slim-bullseye as base | ||
|
||
RUN groupadd user && \ | ||
useradd --create-home --home-dir /home/user -g user -s /bin/bash user | ||
|
||
WORKDIR /home/user | ||
COPY . /app | ||
WORKDIR /app | ||
RUN pixi run build-wheel | ||
RUN pixi run postinstall-production | ||
RUN pixi shell-hook -e prod > /shell-hook | ||
RUN echo 'exec "$@"' >> /shell-hook | ||
|
||
#-------------------- | ||
|
||
FROM base as python-deps | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y --no-install-recommends build-essential libcurl4-openssl-dev libssl-dev curl | ||
FROM ubuntu:24.04 AS web | ||
|
||
RUN python3 -m venv /home/user/.venv | ||
# only copy the production environment into prod container | ||
COPY --from=build /app/.pixi/envs/prod /app/.pixi/envs/prod | ||
COPY --from=build /shell-hook /shell-hook | ||
|
||
COPY requirements.txt ./ | ||
|
||
RUN . /home/user/.venv/bin/activate && pip install --require-hashes -r requirements.txt | ||
|
||
RUN curl --output sratoolkit.tar.gz https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/3.0.2/sratoolkit.3.0.2-ubuntu64.tar.gz | ||
RUN tar xf sratoolkit.tar.gz | ||
|
||
#-------------------- | ||
|
||
FROM base as web | ||
|
||
COPY --from=python-deps /home/user/.venv /home/user/.venv | ||
|
||
WORKDIR /app/wort | ||
|
||
ADD wortapp.py pyproject.toml ./ | ||
RUN groupadd user && \ | ||
useradd --create-home --home-dir /home/user -g user -s /bin/bash user | ||
|
||
COPY wort wort | ||
COPY config config | ||
COPY wortapp.py /app | ||
COPY config/ /app/config | ||
|
||
RUN . /home/user/.venv/bin/activate && pip install flit && FLIT_ROOT_INSTALL=1 flit install --symlink | ||
WORKDIR /app | ||
|
||
USER user | ||
USER user | ||
|
||
ENV PATH "/home/user/.venv/bin:$PATH" | ||
CMD . /home/user/.venv/bin/activate && gunicorn -b 0.0.0.0:5000 --access-logfile - "wort.app:create_app()" | ||
ENTRYPOINT ["/bin/bash", "/shell-hook"] | ||
CMD ["gunicorn", "-b", "0.0.0.0:5000", "--access-logfile", "-", "'wortapp:create_app()'"] | ||
|
||
#-------------------- | ||
|
||
FROM base as worker | ||
FROM ubuntu:24.04 AS worker | ||
|
||
COPY --from=builder /usr/local/cargo/bin/decoct /usr/local/bin/sourmash | ||
COPY --from=python-deps /home/user/sratoolkit.3.0.2-ubuntu64/bin /home/user/sratoolkit.3.0.2-ubuntu64/bin | ||
COPY --from=python-deps /home/user/.venv /home/user/.venv | ||
# only copy the production environment into prod container | ||
COPY --from=build /app/.pixi/envs/prod /app/.pixi/envs/prod | ||
COPY --from=build /shell-hook /shell-hook | ||
|
||
ENV PATH "/home/user/.venv/bin:$PATH" | ||
RUN groupadd user && \ | ||
useradd --create-home --home-dir /home/user -g user -s /bin/bash user | ||
|
||
ENV PATH "$PATH:/home/user/sratoolkit.3.0.2-ubuntu64/bin" | ||
COPY wortapp.py /app | ||
COPY config/ /app/config | ||
|
||
# needed for celery[sqs] | ||
RUN apt-get update | ||
RUN apt-get install -y --no-install-recommends libcurl4-openssl-dev libssl-dev | ||
WORKDIR /app | ||
|
||
USER user | ||
USER user | ||
|
||
# Configure sra-toolkit to disable cache | ||
RUN mkdir .ncbi | ||
|
||
RUN echo '## auto-generated configuration file - DO NOT EDIT ##''' >> .ncbi/user-settings.mkfg | ||
RUN echo '' >> .ncbi/user-settings.mkfg | ||
RUN echo '/LIBS/GUID = "7737545d-30d4-4d05-875a-2c562df521d5"' >> .ncbi/user-settings.mkfg | ||
RUN echo '/config/default = "false"' >> .ncbi/user-settings.mkfg | ||
RUN echo '/libs/cloud/accept_aws_charges = "false"' >> .ncbi/user-settings.mkfg | ||
RUN echo '/libs/cloud/report_instance_identity = "true"' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/file/volumes/flatAd = "."' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/refseq/volumes/refseqAd = "."' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/sra/volumes/sraAd = "."' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/sraPileup/volumes/ad = "."' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/sraRealign/volumes/ad = "."' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/root = "."' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/default-path = "/root/ncbi"' >> .ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/main/public/cache-disabled = "true"' >> .ncbi/user-settings.mkfg | ||
|
||
COPY wort wort | ||
COPY config config | ||
RUN mkdir ~/.ncbi | ||
|
||
RUN echo '## auto-generated configuration file - DO NOT EDIT ##''' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/LIBS/GUID = "7737545d-30d4-4d05-875a-2c562df521d5"' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/config/default = "false"' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/libs/cloud/accept_aws_charges = "false"' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/libs/cloud/report_instance_identity = "true"' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/file/volumes/flatAd = "."' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/refseq/volumes/refseqAd = "."' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/sra/volumes/sraAd = "."' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/sraPileup/volumes/ad = "."' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/apps/sraRealign/volumes/ad = "."' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/ad/public/root = "."' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/default-path = "/root/ncbi"' >> ~/.ncbi/user-settings.mkfg | ||
RUN echo '/repository/user/main/public/cache-disabled = "true"' >> ~/.ncbi/user-settings.mkfg | ||
|
||
ENV RAYON_NUM_THREADS 3 | ||
CMD celery -A wort.blueprints.compute.tasks worker -Q compute_small,compute_medium,genomes --without-gossip --without-mingle --without-heartbeat -l INFO -c 1 | ||
ENTRYPOINT ["/bin/bash", "/shell-hook"] | ||
CMD ["celery", "-A", "wort.blueprints.compute.tasks", "worker", "-Q", "compute_small,compute_medium,genomes", "--without-gossip", "--without-mingle", "--without-heartbeat", "-l", "INFO", "-c", "1"] |
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
Oops, something went wrong.