Simplify docker action

This commit is contained in:
Max Stanley
2023-11-30 18:06:19 +00:00
parent d2d082ec08
commit 5865b46a26
3 changed files with 35 additions and 33 deletions

View File

@@ -11,3 +11,4 @@
Dockerfile
.dockerignore
docker-compose.yml
README.md

View File

@@ -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 }}

View File

@@ -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.