Skip to content

Commit

Permalink
feat: add optional node_bin mmdc (mermaid)
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Aug 16, 2024
1 parent df4e84c commit 80925aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ RUNNER_IMAGE_NAME := ${IMAGE_REPO}/node
RUNNER_IMAGE_TAG := bookworm
PUPPETEER_IMAGE_NAME := ${IMAGE_REPO}/node-puppeteer
PUPPETEER_IMAGE_TAG := bookworm
MERMAID_IMAGE_NAME := ${IMAGE_REPO}/mermaid
MERMAID_IMAGE_TAG := bookworm
AUTH_PROXY_IMAGE_NAME := ${IMAGE_REPO}/auth-proxy
AUTH_PROXY_IMAGE_TAG := latest
CONTAINER_PROXY_IMAGE_NAME := ${IMAGE_REPO}/container-socket-proxy
Expand Down Expand Up @@ -220,7 +222,7 @@ image_runner_node_ios: submodules image_runner_node
-f './imags/cocoapods-runner/Containerfile' \
./imags/cocoapods-runner

# for mermaid etc
# base for mermaid etc
image_runner_node_puppeteer: IMAGE_NAME = ${PUPPETEER_IMAGE_NAME}
image_runner_node_puppeteer: IMAGE_TAG = ${PUPPETEER_IMAGE_TAG}
image_runner_node_puppeteer: submodules # image_runner_node
Expand All @@ -232,6 +234,17 @@ image_runner_node_puppeteer: submodules # image_runner_node
-f './imags/node-puppeteer/Containerfile' \
./imags/node-puppeteer

image_runner_mermaid: IMAGE_NAME = ${MERMAID_IMAGE_NAME}
image_runner_mermaid: IMAGE_TAG = ${MERMAID_IMAGE_TAG}
image_runner_mermaid: submodules # image_runner_node
${CMD} buildx build \
${BUILD_OPTIONS} \
--build-arg "SHELL=${USER_SHELL}" \
--build-arg "NODE_VERSION=20" \
-t "${IMAGE_NAME}:${IMAGE_TAG}" \
-f './imags/node-puppeteer/Containerfile.mermaid' \
./imags/node-puppeteer

image_runner_node_all: IMAGE_NAME = ${RUNNER_IMAGE_NAME}
image_runner_node_all: IMAGE_TAG = ${RUNNER_IMAGE_TAG}
image_runner_node_all: image_runner_node_20 image_runner_node_18 image_runner_node_22 # image_runner_node_ios
Expand Down Expand Up @@ -479,6 +492,9 @@ images: images_deps image_runner_node image_dnsmasq image_gpg_pk image_dev_shell

images_gui: images image_xterm image_firefox image_vnc

# these are optional and not enabled by default due to extra build time and disk usage
images_opt: images_runner_mermaid image_runner_node_all

images_test: images image_nvim_test

test: test_nvim test_runner_node test_gpg_pk
Expand Down
5 changes: 5 additions & 0 deletions contrib/bin/mmdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
export RUNNER_IMAGE=localhost/l7/mermaid:bookworm
RUNNER_OPTS="${RUNNER_OPTS} -i "
RUNNER_ENV="${RUNNER_ENV} PUPPETEER_CACHE_DIR=/opt/puppeteer"
l7-run-node mmdc ${@}
12 changes: 12 additions & 0 deletions imags/node-puppeteer/Containerfile.mermaid
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# syntax=docker/dockerfile:1.4-labs
ARG BASE_IMAGE=localhost/l7/node-puppeteer:bookworm
FROM ${BASE_IMAGE}
USER root

WORKDIR /usr/local/lib
RUN NPM_CONFIG_PREFIX='' npm add 'git+https://github.com/legobeat/mermaid-cli/#02153e234a876c95b44e1af84d02bca65681f6d1' \
&& chown -R node /home/user /home/node \
# allow user installing new engines but not modifying bundled ones \
&& chown node /opt/puppeteer/ /opt/puppeteer/*

USER node

0 comments on commit 80925aa

Please sign in to comment.