Skip to content

Commit

Permalink
Merge develop branch into main (#1)
Browse files Browse the repository at this point in the history
* Initial commit of code base

---------

Co-authored-by: Michael Demoret <[email protected]>
  • Loading branch information
ashsong-nv and mdemoret-nv authored Nov 7, 2024
1 parent afb2928 commit 5161905
Show file tree
Hide file tree
Showing 99 changed files with 23,308 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
images/** filter=lfs diff=lfs merge=lfs -text
197 changes: 197 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
###### Place new entries directly below this line! ######

# Ignore anything in the ./.tmp directory
.tmp/

# Ignore user-generated fiass databases
vdb/

# Explicitly ignore .vscode/. Shared settings should go in morpheus.code-workspace
# and user settings will go in .vscode/
.vscode/

# Ignore .sqlite cache files
*.sqlite


##### Do not alter the items below this line! #####
########## They are managed by a script! ##########

# Created by https://www.gitignore.io/api/vim,c++,cmake,python,synology

### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### CMake ###
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

### Synology ###
# Thumbnails
@eaDir
# Recycle bin
\#recycle

### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~


# End of https://www.gitignore.io/api/vim,c++,cmake,python,synology
Empty file added .tmp/.gitkeep
Empty file.
97 changes: 97 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG BASE_IMG=nvcr.io/nvidia/cuda
ARG BASE_IMG_TAG=12.5.1-base-ubuntu22.04

FROM ${BASE_IMG}:${BASE_IMG_TAG} as base

# Install necessary dependencies using apt-get
RUN apt-get update && apt-get install -y \
git \
git-lfs \
wget \
&& apt-get clean

# Install miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh \
&& bash /tmp/miniconda.sh -b -p /opt/conda \
&& rm /tmp/miniconda.sh

# Add conda to the PATH
ENV PATH=/opt/conda/bin:$PATH

# Install Mamba, a faster alternative to conda, within the base environment
RUN --mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
conda install -y mamba -n base -c conda-forge

# Create base environment
RUN --mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
conda create -y --name morpheus-vuln-analysis

# Activate the environment (make it default for subsequent commands)
RUN echo "source activate morpheus-vuln-analysis" >> ~/.bashrc

# Set default shell to bash
SHELL ["/bin/bash", "-c"]

# Add conda channels required for the Morpheus dependencies
RUN source activate morpheus-vuln-analysis \
&& conda config --env --add channels conda-forge \
&& conda config --env --add channels nvidia \
&& conda config --env --add channels rapidsai \
&& conda config --env --add channels pytorch

RUN --mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
source activate morpheus-vuln-analysis &&\
mamba install -y -c conda-forge tini=0.19

WORKDIR /workspace_examples/

# Copy custom entrypoint script
# Copy just the conda env first to minimize cache busting
COPY requirements.yaml /workspace_examples/requirements.yaml

SHELL ["/bin/bash", "-c"]

# Install dependencies
RUN --mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
--mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
source activate morpheus-vuln-analysis &&\
mamba env update morpheus-vuln-analysis -f ./requirements.yaml

# If any changes have been made from the base image, recopy the sources
COPY . /workspace_examples/

# Mark all git repos as safe to avoid git errors
RUN git config --global --add safe.directory "*"

ENTRYPOINT [ "/opt/conda/envs/morpheus-vuln-analysis/bin/tini", "--", "/workspace_examples/docker/scripts/entrypoint.sh"]

# ===== Setup for development =====
FROM base as runtime

RUN --mount=type=cache,id=pip_cache,target=/root/.cache/pip,sharing=locked \
--mount=type=cache,id=conda_pkgs,target=/opt/conda/pkgs,sharing=locked \
source activate morpheus-vuln-analysis &&\
mamba install -y -c conda-forge \
ipywidgets \
jupyter_contrib_nbextensions \
# notebook v7 is incompatible with jupyter_contrib_nbextensions
notebook=6 &&\
jupyter contrib nbextension install --user &&\
pip install jupyterlab_nvdashboard==0.9

CMD ["jupyter-lab", "--no-browser", "--allow-root", "--ip='*'", "--NotebookApp.token=''", "--NotebookApp.password=''"]
Loading

0 comments on commit 5161905

Please sign in to comment.