Add new containers to streamline setup

This commit is contained in:
Michael Hohn
2024-08-29 13:22:59 -07:00
committed by =Michael Hohn
parent 5021fc824b
commit 681fcdab8c
5 changed files with 121 additions and 0 deletions

View File

@@ -10,6 +10,30 @@ html: README.html
%.html: %.md
pandoc --toc=true --standalone $< --out $@
# Build the qldbtools container image
dbt: client-qldbtools-container
client-qldbtools-container:
cd client/containers/qldbtools && \
docker build -t $@ .
# Run a shell in the container with the qldbtools
dbt-run:
docker run --rm -it client-qldbtools-container /bin/bash
dbt-run:
docker run --rm -it client-qldbtools-container /bin/bash
dbt-check:
docker run --rm -it client-qldbtools-container mc-db-initial-info
ghm: client-ghmrva-container
client-ghmrva-container:
cd client/containers/ghmrva && \
docker build -t $@ .
ghm-run:
docker run --rm client-ghmrva-container --help
server:
cd cmd/server && GOOS=linux GOARCH=arm64 go build

View File

@@ -0,0 +1,30 @@
# 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 .
# # Set the entrypoint
# CMD ["/bin/bash"]
# Use a minimal base image for the final container
FROM debian:bookworm
# Set the working directory inside the final image
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"]

View File

@@ -0,0 +1,22 @@
# Use a minimal base image
FROM busybox
# This data container holds data from existing runs. It cannot be built without
# ready data.
# Before running docker build, make sure you have set up the directory mirrors
# dbstore-data and scratch.
# E.g.:
# cd ~/work-gh/mrva/mrvacommander/client/containers/mrvadata/
# mkdir tmp
# cp -r ../../../dbstore-data tmp
# cp -r ../../qldbtools/scratch tmp
# Mirror parts of the host directory structure in the container
COPY tmp/dbstore-data /data/mrvacommander/dbstore-data
COPY tmp/scratch /data/mrvacommander/qldbtools/scratch
# Just run sh if this container is ever started
CMD ["sh"]

View File

@@ -0,0 +1,16 @@
all: image
image:
docker build -t mrvadata .
image-shell: image
docker run --rm -it mrvadata sh
image-push: image
docker tag mrvadata ghcr.io/hohn/mrvadata:0.1.24
docker push ghcr.io/hohn/mrvadata:0.1.24
image-test:
docker pull ghcr.io/hohn/mrvadata:0.1.24
docker run --rm -it --name test-mrvadata ghcr.io/hohn/mrvadata:0.1.24 sh

View File

@@ -0,0 +1,29 @@
# 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/mrvacommander.git && \
cd mrvacommander && \
git checkout hohn-0.1.24-demo
# Change to the client directory
WORKDIR /work-gh/mrva/mrvacommander/client/qldbtools/
# We're in a container, so use pip globally -- no virtual env
RUN pip install --upgrade pip
# Install the required Python packages from requirements.txt
RUN pip install -r requirements.txt
# Install qldbtools
RUN pip install .
# Set the default entrypoint
CMD ["/bin/bash"]