updated mermaid-cli
This commit is contained in:
parent
59cf3052b1
commit
b2d2782363
81
Dockerfile
81
Dockerfile
|
|
@ -1,44 +1,53 @@
|
||||||
# This stage builds the go executable.
|
# Multi-stage build
|
||||||
FROM golang:1.19.3-buster as go
|
|
||||||
|
# Stage 1: Build the Go executable
|
||||||
|
FROM golang:1.21-bookworm as go-builder
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
COPY ./ ./
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
RUN go build -o bin/app cmd/app/main.go
|
COPY cmd/ ./cmd/
|
||||||
|
COPY internal/ ./internal/
|
||||||
|
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/app cmd/app/main.go
|
||||||
|
|
||||||
# Final stage that will be pushed.
|
# Stage 2: Setup Node.js environment with mermaid CLI
|
||||||
FROM debian:buster-slim
|
FROM node:20-bookworm-slim as node-builder
|
||||||
|
|
||||||
FROM node:18.10.0-buster-slim as node
|
|
||||||
|
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
# copy the mermaidcli node package into the container and install
|
# Copy mermaid CLI package files
|
||||||
COPY ./mermaidcli/* ./
|
COPY ./mermaidcli/package*.json ./
|
||||||
|
COPY ./mermaidcli/puppeteer-config.json ./
|
||||||
|
|
||||||
RUN npm install && npm cache clean --force;
|
# Install Node dependencies
|
||||||
|
RUN npm ci --only=production && npm cache clean --force
|
||||||
|
|
||||||
|
# Stage 3: Final runtime image
|
||||||
|
FROM node:20-bookworm-slim
|
||||||
|
|
||||||
|
# Install system dependencies for Puppeteer
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update 2>/dev/null && \
|
RUN apt-get update && apt-get install -y \
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
gconf-service \
|
fonts-liberation \
|
||||||
|
libappindicator3-1 \
|
||||||
libasound2 \
|
libasound2 \
|
||||||
libatk1.0-0 \
|
|
||||||
libatk-bridge2.0-0 \
|
libatk-bridge2.0-0 \
|
||||||
|
libatk1.0-0 \
|
||||||
libc6 \
|
libc6 \
|
||||||
libcairo2 \
|
libcairo2 \
|
||||||
libcups2 \
|
libcups2 \
|
||||||
libdbus-1-3 \
|
libdbus-1-3 \
|
||||||
libexpat1 \
|
libexpat1 \
|
||||||
libfontconfig1 \
|
libfontconfig1 \
|
||||||
|
libgbm1 \
|
||||||
libgcc1 \
|
libgcc1 \
|
||||||
libgconf-2-4 \
|
|
||||||
libgdk-pixbuf2.0-0 \
|
|
||||||
libglib2.0-0 \
|
libglib2.0-0 \
|
||||||
libgtk-3-0 \
|
libgtk-3-0 \
|
||||||
libnspr4 \
|
libnspr4 \
|
||||||
|
libnss3 \
|
||||||
libpango-1.0-0 \
|
libpango-1.0-0 \
|
||||||
libpangocairo-1.0-0 \
|
libpangocairo-1.0-0 \
|
||||||
libstdc++6 \
|
libstdc++6 \
|
||||||
|
|
@ -55,24 +64,32 @@ RUN apt-get update 2>/dev/null && \
|
||||||
libxrender1 \
|
libxrender1 \
|
||||||
libxss1 \
|
libxss1 \
|
||||||
libxtst6 \
|
libxtst6 \
|
||||||
libxcb-dri3-0 \
|
|
||||||
libgbm1 \
|
|
||||||
ca-certificates \
|
|
||||||
fonts-liberation \
|
|
||||||
libappindicator1 \
|
|
||||||
libnss3 \
|
|
||||||
lsb-release \
|
lsb-release \
|
||||||
xdg-utils \
|
|
||||||
wget \
|
wget \
|
||||||
libxshmfence1 \
|
xdg-utils \
|
||||||
2>/dev/null && rm -rf /var/lib/apt/lists/*;
|
--no-install-recommends && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=go /root/bin/app ./app
|
WORKDIR /root
|
||||||
|
|
||||||
RUN mkdir -p ./in
|
# Copy Go executable
|
||||||
RUN mkdir -p ./out
|
COPY --from=go-builder /root/bin/app ./app
|
||||||
RUN chmod 0777 ./in
|
|
||||||
RUN chmod 0777 ./out
|
|
||||||
|
|
||||||
|
# Copy Node.js dependencies and mermaid CLI
|
||||||
|
COPY --from=node-builder /root/node_modules ./node_modules
|
||||||
|
COPY --from=node-builder /root/package*.json ./
|
||||||
|
COPY --from=node-builder /root/puppeteer-config.json ./
|
||||||
|
|
||||||
|
# Create directories for input/output
|
||||||
|
RUN mkdir -p ./in ./out && \
|
||||||
|
chmod 0777 ./in ./out
|
||||||
|
|
||||||
|
# Health check
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
|
CMD wget --no-verbose --tries=1 --spider http://localhost:80/health || exit 1
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Run the application
|
||||||
CMD ["./app", "--allow-all-origins=true", "--mermaid=./node_modules/.bin/mmdc", "--in=./in", "--out=./out", "--puppeteer=./puppeteer-config.json"]
|
CMD ["./app", "--allow-all-origins=true", "--mermaid=./node_modules/.bin/mmdc", "--in=./in", "--out=./out", "--puppeteer=./puppeteer-config.json"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mermaid-server:
|
||||||
|
build: .
|
||||||
|
container_name: mermaid-server
|
||||||
|
ports:
|
||||||
|
- "7000:80" # Map host port 7000 to container port 80
|
||||||
|
volumes:
|
||||||
|
- ./in:/root/in # optional: persist input for caching
|
||||||
|
- ./out:/root/out # optional: persist output for debugging
|
||||||
|
environment:
|
||||||
|
ALLOW_ALL_ORIGINS: "true"
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
start_period: 5s
|
||||||
|
retries: 3
|
||||||
2
go.mod
2
go.mod
|
|
@ -1,6 +1,6 @@
|
||||||
module github.com/tomwright/mermaid-server
|
module github.com/tomwright/mermaid-server
|
||||||
|
|
||||||
go 1.15
|
go 1.21
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/tomwright/grace v0.1.2
|
github.com/tomwright/grace v0.1.2
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -9,6 +9,6 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mermaid-js/mermaid-cli": "^9.1.7"
|
"@mermaid-js/mermaid-cli": "^11.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
quadrantChart
|
||||||
|
title Website Performance Analysis
|
||||||
|
x-axis Low Traffic --> High Traffic
|
||||||
|
y-axis Low Conversion --> High Conversion
|
||||||
|
|
||||||
|
quadrant-1 Stars (High Traffic, High Conversion)
|
||||||
|
quadrant-2 Question Marks (Low Traffic, High Conversion)
|
||||||
|
quadrant-3 Dogs (Low Traffic, Low Conversion)
|
||||||
|
quadrant-4 Cash Cows (High Traffic, Low Conversion)
|
||||||
|
|
||||||
|
Homepage: [0.8, 0.9]
|
||||||
|
Product Pages: [0.7, 0.8]
|
||||||
|
Blog Posts: [0.6, 0.4]
|
||||||
|
Contact Page: [0.2, 0.7]
|
||||||
|
About Page: [0.3, 0.3]
|
||||||
|
Pricing Page: [0.5, 0.8]
|
||||||
|
Support Page: [0.4, 0.5]
|
||||||
|
FAQ Page: [0.3, 0.6]
|
||||||
Loading…
Reference in New Issue