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
|
Dockerfile
|
||||||
.dockerignore
|
.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:
|
on:
|
||||||
push:
|
push:
|
||||||
# Publish `master` as Docker `latest` image.
|
|
||||||
branches:
|
branches:
|
||||||
|
# Publish `master` as Docker `latest` image.
|
||||||
- master
|
- master
|
||||||
|
# Publish `nightly` as Docker `nightly` image.
|
||||||
# Publish `v1.2.3` tags as releases.
|
- develop
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
# Run tests for all PRs to master and develop.
|
# Run tests for all PRs to master and develop.
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -30,40 +28,21 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
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
|
- uses: docker/metadata-action@v5
|
||||||
if: github.ref_type == 'tag'
|
|
||||||
id: meta
|
id: meta
|
||||||
with:
|
with:
|
||||||
images: ghcr.io/${{ github.repository }}
|
images: ghcr.io/${{ github.repository }}
|
||||||
# this will generate tags in the following format:
|
|
||||||
#
|
|
||||||
# latest
|
|
||||||
# 1.2.3
|
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=${{ env.RELEASE_VERSION }}
|
||||||
type=semver,pattern={{version}}
|
|
||||||
- uses: docker/build-push-action@v5
|
- uses: docker/build-push-action@v5
|
||||||
if: github.ref_type == 'tag'
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
target: mermaid
|
target: mermaid
|
||||||
push: true
|
push: ${{ github.event_name == 'push' }}
|
||||||
pull: true
|
pull: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
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
|
### 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`
|
Default is `https://mermaid.ink`
|
||||||
|
|
||||||
### To configure Kroki Instance URL
|
### 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`
|
Default is `https://kroki.io`
|
||||||
|
|
||||||
### Development
|
### Development
|
||||||
@@ -45,6 +45,28 @@ docker compose up --build
|
|||||||
|
|
||||||
Then open http://localhost:3000
|
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
|
## Setup
|
||||||
|
|
||||||
Below link will help you making a copy of the repository in your local system.
|
Below link will help you making a copy of the repository in your local system.
|
||||||
|
|||||||
Reference in New Issue
Block a user