Standardize container build workflow for v0.4.5

- Build Go binaries (gh-mrva, mrvaserver, mrvaagent) in source repos before
  copying to container dirs

- Apply consistent v0.4.5 tagging across all containers (ghmrva, vscode,
  hepc, server, agent)

- Update hepc to sync mrvahepc source with venv and .git exclusions

- Verify deployment with docker-compose-demo.yml and bin/ma.send-request
  tests
This commit is contained in:
2025-11-26 12:39:59 -08:00
committed by =michael hohn
parent 344ebd8d9b
commit 13a065545e
5 changed files with 71 additions and 90 deletions

View File

@@ -115,22 +115,54 @@
# enter vm (on mac) # enter vm (on mac)
limactl shell ubu limactl shell ubu
cd ~/work-gh/mrva/mrva-docker/containers/ghmrva/ #** ghmrva
docker build -t client-ghmrva-container:0.4.0 . cont_dir=~/work-gh/mrva/mrva-docker/containers/ghmrva/
build_dir=~/work-gh/mrva/gh-mrva
#
cd $build_dir
go build
# Copy the new binary
cp gh-mrva $cont_dir
#
cd $cont_dir
docker build -t mrva-gh-mrva:0.4.5 .
#** vscode
cd ~/work-gh/mrva/mrva-docker/containers/vscode/ cd ~/work-gh/mrva/mrva-docker/containers/vscode/
docker build -t code-server-initialized:0.4.0 . docker build -t code-server-initialized:0.4.5 .
#** hepc
# *slow* in vm with shared folders # *slow* in vm with shared folders
cd ~/work-gh/mrva/mrva-docker/containers/hepc &&\ cd ~/work-gh/mrva/mrva-docker/containers/hepc
rm -fR ./mrvahepc && cp -r ../../../mrvahepc . rm -fR ./mrvahepc &&
docker build -t mrva-hepc-container:0.4.0 -f Dockerfile . rsync -a --exclude='*/venv/*' \
--exclude='*/\.git/*' \
../../../mrvahepc .
docker build -t mrva-hepc-container:0.4.5 -f Dockerfile .
cd ~/work-gh/mrva/mrva-docker/containers/server/ #** server
docker build -t mrva-server:0.4.0 . cont_dir=~/work-gh/mrva/mrva-docker/containers/server/
build_dir=~/work-gh/mrva/mrvaserver
#
cd $build_dir
go build
# Copy the new binary
cp mrvaserver $cont_dir
#
cd $cont_dir
docker build -t mrva-server:0.4.5 .
cd ~/work-gh/mrva/mrva-docker/containers/agent/ #** agent
docker build -t mrva-agent:0.4.0 . cont_dir=~/work-gh/mrva/mrva-docker/containers/agent/
build_dir=~/work-gh/mrva/mrvaagent
#
cd $build_dir
go build
# Copy the new binary
cp mrvaagent $cont_dir
#
cd $cont_dir
docker build -t mrva-agent:0.4.5 .
# #
#* Start the containers #* Start the containers
@@ -140,14 +172,16 @@
docker-compose -f docker-compose-demo.yml up docker-compose -f docker-compose-demo.yml up
# # #
#* Populate the db container if needed. # #* Populate the db container if needed.
# Note: this requires # # Note: this requires
# /Users/hohn/work-gh/mrva/mrva-open-source-download , # # /Users/hohn/work-gh/mrva/mrva-open-source-download ,
# a large tree not part of this repository. # # a large tree not part of this repository.
# # #
cd ~/work-gh/mrva/mrvacommander/client/qldbtools && uv sync # # This is older. With the use of hepc, this should not be necessary.
uv run bin/mc-db-populate-minio < scratch/db-info-3.csv # #
# cd ~/work-gh/mrva/mrvacommander/client/qldbtools && uv sync
# uv run bin/mc-db-populate-minio < scratch/db-info-3.csv
#* update the binaries in a running container #* update the binaries in a running container
#** compile server locally #** compile server locally

View File

@@ -1,24 +1,5 @@
FROM golang:1.22 AS builder # Runtime container - binary built on host
FROM ubuntu:24.04
# Set the working directory inside the container
WORKDIR /app
# Copy the host directory containing the git clone to the container
COPY mrvaagent.tmp /app/mrvaagent
# Set the environment variables for Go modules
ENV GO111MODULE=on
ENV CGO_ENABLED=0
# Build the project
WORKDIR /app/mrvaagent
RUN go mod tidy && go build -o /app/mrvaagent-binary
# # Download dependencies
# RUN go mod download
# Create a runtime container
FROM ubuntu:24.04 AS runner
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Build argument for CodeQL version, defaulting to the latest release # Build argument for CodeQL version, defaulting to the latest release
@@ -46,8 +27,8 @@ ENV CODEQL_CLI_PATH=/opt/codeql/codeql
# This env var has no functional effect on CodeQL when running on x86_64 linux # This env var has no functional effect on CodeQL when running on x86_64 linux
ENV CODEQL_JAVA_HOME=/usr ENV CODEQL_JAVA_HOME=/usr
# Copy the built binary from the builder stage # Copy the host-built binary
COPY --from=builder /app/mrvaagent-binary /usr/local/bin/mrvaagent COPY mrvaagent /usr/local/bin/mrvaagent
# Copy the binary-replacement support script to the container # Copy the binary-replacement support script to the container
COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh

View File

@@ -1,24 +1,7 @@
# ######################
# Use an official Golang image as the base image
FROM golang:1.22 AS builder
# Set the working directory inside the container
WORKDIR /work-gh/mrva/gh-mrva
# Clone the repository
RUN git clone https://github.com/hohn/gh-mrva.git . &&\
git checkout hohn-0.1.24-demo
# Download dependencies
RUN go mod download
# Build the Go binary
RUN go build .
# ###################### # ######################
# Provide codeql and java # Provide codeql and java
# # Binary built on host
FROM ubuntu:24.04 AS runner FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Build argument for CodeQL version, defaulting to the latest release # Build argument for CodeQL version, defaulting to the latest release
@@ -54,8 +37,8 @@ ENV CODEQL_JAVA_HOME=/usr
# Set the working directory inside the final image # Set the working directory inside the final image
WORKDIR /app WORKDIR /app
# Copy the binary from the builder stage # Copy the host-built binary
COPY --from=builder /work-gh/mrva/gh-mrva/gh-mrva /usr/local/bin/gh-mrva COPY gh-mrva /usr/local/bin/gh-mrva
# Put CodeQL on the PATH # Put CodeQL on the PATH
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/codeql ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/codeql

View File

@@ -1,24 +1,5 @@
FROM golang:1.22 AS builder # Runtime container - binary built on host
FROM ubuntu:24.04
# Set the working directory inside the container
WORKDIR /app
# Copy the host directory containing the git clone to the container
COPY mrvaserver.tmp /app/mrvaserver
# Set the environment variables for Go modules
ENV GO111MODULE=on
ENV CGO_ENABLED=0
# Build the project
WORKDIR /app/mrvaserver
RUN go mod tidy && go build -o /app/mrvaserver-binary
# # Download dependencies
# RUN go mod download
# Create a runtime container
FROM ubuntu:24.04 AS runner
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Build argument for CodeQL version, defaulting to the latest release # Build argument for CodeQL version, defaulting to the latest release
@@ -46,8 +27,8 @@ ENV CODEQL_CLI_PATH=/opt/codeql/codeql
# This env var has no functional effect on CodeQL when running on x86_64 linux # This env var has no functional effect on CodeQL when running on x86_64 linux
ENV CODEQL_JAVA_HOME=/usr ENV CODEQL_JAVA_HOME=/usr
# Copy the built binary from the builder stage # Copy the host-built binary
COPY --from=builder /app/mrvaserver-binary /usr/local/bin/mrvaserver COPY mrvaserver /usr/local/bin/mrvaserver
# Copy the binary-replacement support script to the container # Copy the binary-replacement support script to the container
COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh

View File

@@ -38,15 +38,17 @@ services:
client-ghmrva: client-ghmrva:
# ./containers/ghmrva/Dockerfile # ./containers/ghmrva/Dockerfile
container_name: mrva-ghmrva container_name: mrva-ghmrva
image: client-ghmrva-container:0.4.0 image: mrva-gh-mrva:0.4.5
network_mode: "service:server" # Share the 'server' network namespace network_mode: "service:server" # Share the 'server' network namespace
environment: environment:
- SERVER_URL=http://localhost:8080 # 'localhost' now refers to 'server' - SERVER_URL=http://localhost:8080 # 'localhost' now refers to 'server'
- MRVA_SERVER_URL=http://server:8080
code-server: code-server:
# ./containers/vscode/Dockerfile # ./containers/vscode/Dockerfile
container_name: mrva-code-server container_name: mrva-code-server
image: code-server-initialized:0.4.0 image: code-server-initialized:0.4.5
ports: ports:
- "9080:9080" - "9080:9080"
# XX: Include codeql binary in code-server (if it's not there already) # XX: Include codeql binary in code-server (if it's not there already)
@@ -57,7 +59,7 @@ services:
hepc: hepc:
# ./containers/hepc/Dockerfile # ./containers/hepc/Dockerfile
image: mrva-hepc-container:0.4.0 image: mrva-hepc-container:0.4.5
container_name: mrva-hepc container_name: mrva-hepc
hostname: hepc hostname: hepc
command: >- command: >-
@@ -89,7 +91,7 @@ services:
server: server:
# ./containers/server/Dockerfile # ./containers/server/Dockerfile
image: mrva-server:0.4.0 image: mrva-server:0.4.5
command: [ '--mode=container', '--loglevel=debug' ] command: [ '--mode=container', '--loglevel=debug' ]
container_name: mrva-server container_name: mrva-server
hostname: server hostname: server
@@ -127,7 +129,7 @@ services:
agent: agent:
# ./containers/agent/Dockerfile # ./containers/agent/Dockerfile
image: mrva-agent:0.4.0 image: mrva-agent:0.4.5
command: [ '--loglevel=debug' ] command: [ '--loglevel=debug' ]
container_name: mrva-agent container_name: mrva-agent
hostname: agent hostname: agent