From 34958e4cf41c43c816d40a1f3c6c2533bbb2bafb Mon Sep 17 00:00:00 2001 From: Michael Hohn Date: Thu, 12 Sep 2024 09:49:25 -0700 Subject: [PATCH] WIP: Working individual containers and docker compose demo --- README.md | 6 + client/containers/ghmrva/Dockerfile | 7 +- client/containers/qldbtools/Dockerfile | 5 +- client/containers/qldbtools/Makefile | 24 +++ client/containers/qldbtools/README.org | 9 +- client/containers/vscode/Dockerfile | 2 + client/containers/vscode/README.org | 12 +- client/containers/vscode/settings.json | 2 +- docker-compose-demo.yml | 234 ++++++++++++++----------- 9 files changed, 175 insertions(+), 126 deletions(-) create mode 100644 client/containers/qldbtools/Makefile diff --git a/README.md b/README.md index f111260..a2c5941 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,12 @@ docker-compose. cd ~/work-gh/mrva/mrvacommander docker-compose up --build +1. Start the server containers and the desktop/demo containers + + cd ~/work-gh/mrva/mrvacommander/ + docker-compose down --remove-orphans + docker-compose -f docker-compose-demo.yml up -d + 1. Test server via remote client by following the steps in [gh-mrva](https://github.com/hohn/gh-mrva/blob/connection-redirect/README.org#compacted-edit-run-debug-cycle) ### Some general docker-compose commands diff --git a/client/containers/ghmrva/Dockerfile b/client/containers/ghmrva/Dockerfile index e2e5cbf..c32e924 100644 --- a/client/containers/ghmrva/Dockerfile +++ b/client/containers/ghmrva/Dockerfile @@ -14,9 +14,6 @@ RUN go mod download # Build the Go binary RUN go build . -# # Set the entrypoint -# CMD ["/bin/bash"] - # Use a minimal base image for the final container FROM debian:bookworm @@ -26,5 +23,5 @@ WORKDIR /app # Copy the binary from the builder stage COPY --from=builder /work-gh/mrva/gh-mrva/gh-mrva /usr/local/bin/gh-mrva -# Set the entrypoint to the binary -ENTRYPOINT ["gh-mrva"] +# Run forever +CMD ["tail", "-f", "/dev/null"] diff --git a/client/containers/qldbtools/Dockerfile b/client/containers/qldbtools/Dockerfile index e679cca..158a335 100644 --- a/client/containers/qldbtools/Dockerfile +++ b/client/containers/qldbtools/Dockerfile @@ -25,5 +25,6 @@ RUN pip install -r requirements.txt # Install qldbtools RUN pip install . -# Set the default entrypoint -CMD ["/bin/bash"] +# Run forever +CMD ["tail", "-f", "/dev/null"] + diff --git a/client/containers/qldbtools/Makefile b/client/containers/qldbtools/Makefile new file mode 100644 index 0000000..df45b3b --- /dev/null +++ b/client/containers/qldbtools/Makefile @@ -0,0 +1,24 @@ +DBT_TARGET := client-qldbtools-container:0.1.24 + +# Build the qldbtools container image +dbt: client-qldbtools-container +client-qldbtools-container: + docker build -t ${DBT_TARGET} . + touch $@ + +# Run a shell in the container with the qldbtools +dbt-run: dbt + docker run --rm -it ${DBT_TARGET} /bin/bash + +# Run one of the scripts in the container as check. Should exit with error. +dbt-check: dbt + docker run --rm -it ${DBT_TARGET} mc-db-initial-info + +dbt-push: dbt + docker tag ${DBT_TARGET} ghcr.io/hohn/${DBT_TARGET} + docker push ghcr.io/hohn/${DBT_TARGET} + touch $@ + +dbt-test: + docker pull ghcr.io/hohn/${DBT_TARGET} + docker run --rm -it --name test-dbt-server ghcr.io/hohn/${DBT_TARGET} sh diff --git a/client/containers/qldbtools/README.org b/client/containers/qldbtools/README.org index 57449bf..4d6bb24 100644 --- a/client/containers/qldbtools/README.org +++ b/client/containers/qldbtools/README.org @@ -1,18 +1,13 @@ * MRVA python tools container - Set upDocker image with python 3.11 and pip and the qldbtools + Set up Docker image with python 3.11 and pip and the qldbtools. The targets are + in the =Makefile=; most important are #+BEGIN_SRC sh # Build - cd ~/work-gh/mrva/mrvacommander make dbt # Check - cd ~/work-gh/mrva/mrvacommander make dbt-check - # Use - cd ~/work-gh/mrva/mrvacommander - make dbt-run - #+END_SRC diff --git a/client/containers/vscode/Dockerfile b/client/containers/vscode/Dockerfile index 6f1df5e..23d9802 100644 --- a/client/containers/vscode/Dockerfile +++ b/client/containers/vscode/Dockerfile @@ -56,7 +56,9 @@ ENV CODEQL_JAVA_HOME=/usr # to user settings. # This is in addition to the environment variable CODEQL_JAVA_HOME which has no # effect on the plugin +USER root COPY ./settings.json /home/coder/.local/share/code-server/User/ +RUN chown -R coder:coder /home/coder/.local/share/code-server/ # Start Code Server ENTRYPOINT ["dumb-init", "code-server", "--bind-addr", "0.0.0.0:9080", "."] diff --git a/client/containers/vscode/README.org b/client/containers/vscode/README.org index 0c4144b..65ea44f 100644 --- a/client/containers/vscode/README.org +++ b/client/containers/vscode/README.org @@ -17,6 +17,7 @@ - Setup inside the container #+BEGIN_SRC shell + cd export PATH=/opt/codeql:$PATH codeql pack init qldemo cd qldemo @@ -26,9 +27,12 @@ - Open a new file =qldemo/simple.ql= and add this this query to it. The plugin will download the CodeQL binaries (but never use them -- the configuration redirects) - #+BEGIN_SRC java + #+BEGIN_SRC sh + cd + cat > qldemo/simple.ql <