mirror of
https://github.com/mermaid-js/mermaid-live-editor.git
synced 2025-03-18 17:16:21 +03:00
Simplify docker action
This commit is contained in:
@@ -10,4 +10,5 @@
|
||||
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
docker-compose.yml
|
||||
docker-compose.yml
|
||||
README.md
|
||||
39
.github/workflows/docker-publish.yml
vendored
39
.github/workflows/docker-publish.yml
vendored
@@ -2,13 +2,11 @@ name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
# Publish `master` as Docker `latest` image.
|
||||
branches:
|
||||
# Publish `master` as Docker `latest` image.
|
||||
- master
|
||||
|
||||
# Publish `v1.2.3` tags as releases.
|
||||
tags:
|
||||
- v*
|
||||
# Publish `nightly` as Docker `nightly` image.
|
||||
- develop
|
||||
|
||||
# Run tests for all PRs to master and develop.
|
||||
pull_request:
|
||||
@@ -30,40 +28,21 @@ jobs:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Get release version
|
||||
run: |
|
||||
RELEASE_VERSION=$([ "${{ github.ref_name }}" = "master" ] && echo "latest" || echo "nightly")
|
||||
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_ENV}"
|
||||
- uses: docker/metadata-action@v5
|
||||
if: github.ref_type == 'tag'
|
||||
id: meta
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
# this will generate tags in the following format:
|
||||
#
|
||||
# latest
|
||||
# 1.2.3
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=semver,pattern={{version}}
|
||||
type=raw,value=${{ env.RELEASE_VERSION }}
|
||||
- uses: docker/build-push-action@v5
|
||||
if: github.ref_type == 'tag'
|
||||
with:
|
||||
context: .
|
||||
target: mermaid
|
||||
push: true
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
pull: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
- uses: docker/metadata-action@v5
|
||||
if: github.ref_type == 'branch'
|
||||
id: meta-nightly
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=raw,value=nightly
|
||||
- uses: docker/build-push-action@v5
|
||||
if: github.ref_type == 'branch'
|
||||
with:
|
||||
context: .
|
||||
target: mermaid
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
pull: true
|
||||
tags: ${{ steps.meta-nightly.outputs.tags }}
|
||||
labels: ${{ steps.meta-nightly.outputs.labels }}
|
||||
|
||||
26
README.md
26
README.md
@@ -29,12 +29,12 @@ docker run --platform linux/amd64 --publish 8000:8080 ghcr.io/mermaid-js/mermaid
|
||||
|
||||
### To configure renderer URL
|
||||
|
||||
When building, Set the Environment variable MERMAID_RENDERER_URL to the rendering service.
|
||||
When building set the MERMAID_RENDERER_URL build argument to the rendering service.
|
||||
Default is `https://mermaid.ink`
|
||||
|
||||
### To configure Kroki Instance URL
|
||||
|
||||
When building, Set the Environment variable MERMAID_KROKI_RENDERER_URL to your Kroki instance.
|
||||
When building set the MERMAID_KROKI_RENDERER_URL build argument to your Kroki instance.
|
||||
Default is `https://kroki.io`
|
||||
|
||||
### Development
|
||||
@@ -45,6 +45,28 @@ docker compose up --build
|
||||
|
||||
Then open http://localhost:3000
|
||||
|
||||
### Building and running images locally
|
||||
|
||||
#### Build
|
||||
|
||||
```bash
|
||||
docker build -t mermaid-js/mermaid-live-editor .
|
||||
```
|
||||
|
||||
#### Run
|
||||
|
||||
```bash
|
||||
docker run --detach --name mermaid-live-editor --publish 8080:8080 mermaid-js/mermaid-live-editor
|
||||
```
|
||||
|
||||
Visit: <http://localhost:8080>
|
||||
|
||||
#### Stop
|
||||
|
||||
```bash
|
||||
docker stop mermaid-live-editor
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
Below link will help you making a copy of the repository in your local system.
|
||||
|
||||
Reference in New Issue
Block a user