working hepc docker test

This commit is contained in:
Michael Hohn
2024-12-18 11:56:45 -08:00
committed by =Michael Hohn
parent b0cf2844e5
commit df8c5f8385
3 changed files with 80 additions and 10 deletions

45
containers/hepc/.gitignore vendored Normal file
View File

@@ -0,0 +1,45 @@
# vscode project dir
.vscode/
# idea project dir
.idea/
# Scratch space
scratch/
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Go workspace file
go.work
go.work.sum
# env file
.env
venv/
venv-*/
*.egg-info
__pycache__
README.html
ChangeLog
notes/*.html
# Make timestamp files
mk.*
# temporaries
*.tmp
# Mac OS
.DS_Store

View File

@@ -1,17 +1,12 @@
# Use a Python 3.11 image as the base
FROM python:3.11-slim
# Install git
RUN apt-get update && apt-get install -y git
# Create the required directory structure
RUN mkdir -p /work-gh/mrva/
# Change to the directory and clone the repository
WORKDIR /work-gh/mrva/
RUN git clone https://github.com/hohn/mrvahepc.git && \
cd mrvahepc && \
git checkout master
COPY ./mrvahepc mrvahepc
# Change to the hepc directory
WORKDIR /work-gh/mrva/mrvahepc
@@ -26,10 +21,11 @@ RUN pip install --no-cache-dir -r requirements.txt
RUN pip install .
# Run server
CMD ["mc-hepc-serve",
"--codeql-db-dir", "db-collection.tmp",
"--host", "127.0.0.1",
"--port", "8070"
WORKDIR /work-gh/mrva/mrvahepc
CMD ["mc-hepc-serve", \
"--codeql-db-dir", "db-collection.tmp", \
"--host", "0.0.0.0", \
"--port", "8070" \
]

View File

@@ -0,0 +1,29 @@
* Container Build
Follow the [[file:~/work-gh/mrva/mrvahepc/README.org::*Usage Sample][Usage Sample]] in mrvahepc to set up the repository and data there. Then:
#+BEGIN_SRC sh
cd ~/work-gh/mrva/mrva-docker/containers/hepc # this directory
rm -fR ./mrvahepc && cp -r ../../../mrvahepc .
# Usual build
docker build -t mrva-hepc-container:0.1.24 -f Dockerfile .
# Build with full output, e.g. RUN ls
docker build --progress=plain --no-cache -t mrva-hepc-container:0.1.24 -f Dockerfile .
# Run standalone
docker run -p 8070:8070 -ti mrva-hepc-container:0.1.24
# Test server
curl 127.0.0.1:8070/index -o - 2>/dev/null | wc -l
curl 127.0.0.1:8070/api/v1/latest_results/codeql-all \
-o - 2>/dev/null | wc -l
url=$(curl 127.0.0.1:8070/api/v1/latest_results/codeql-all \
-o - 2>/dev/null | head -1 | jq -r .result_url)
echo $url
# http://hepc/db/db-collection.tmp/aircrack-ng-aircrack-ng-ctsj-41ebbe.zip
wget $(echo $url|sed 's|http://hepc|http://127.0.0.1:8070|g;')
#+END_SRC