Skip to content

Add Dockerfile for build #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:12 AS builder

# fetch sources
COPY . /usr/app
#RUN wget "https://github.com/kkeisuke/plantuml-editor/archive/refs/heads/master.zip" && \
# unzip "master.zip" && \
# mv plantuml-editor-master /usr/app

WORKDIR /usr/app

# NOTE
# - tailing "/" is important! (At least for VUE_APP_CDN.)
# - VUE_APP_SERVER will never used. (Drop it?)
# See PR#19
# https://github.com/kkeisuke/plantuml-editor/pull/19
ARG VUE_APP_URL=https://plantuml-editor.kkeisuke.com/
ARG VUE_APP_SERVER=https://plantuml-server.kkeisuke.dev/
ARG VUE_APP_CDN=https://plantuml-server.kkeisuke.dev/

# build app
RUN npm install && \
npm run flow-typed && \
npm run build

# NGINX Alpine as minimal web server
FROM nginx:alpine

WORKDIR /usr/share/nginx/html

COPY --from=builder /usr/app/dist/ .
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,50 @@ npm run test:unit
npm run test:e2e
```

or build with docker

```bash
# build with docker
docker build \
-t plantuml-editor \
--build-arg VUE_APP_URL=http://localhost:8080/ \
--build-arg VUE_APP_SERVER=http://localhost:4000/ \
--build-arg VUE_APP_CDN=http://localhost:4000/ \
.

# or with PR#19
# https://github.com/kkeisuke/plantuml-editor/pull/19
docker build \
-t plantuml-editor \
--build-arg VUE_APP_URL=http://localhost:8080 \
--build-arg VUE_APP_CDN=http://localhost:4000 \
.

# run plantuml-editor server with docker
docker run -d -p 8080:80 --name plantuml-editor plantuml-editor
```

or with docker compose

```yaml
version: "3.9"
services:
plantuml-editor:
build:
context: .
dockerfile: Dockerfile
args:
- VUE_APP_URL=http://localhost:8080
- VUE_APP_SERVER=http://localhost:4000/
- VUE_APP_CDN=http://localhost:4000/
restart: always
container_name: plantuml-editor
#environment:
# - TZ=...
ports:
- 8080:80
```

## For development

[PlantUML Server with Docker](https://hub.docker.com/r/plantuml/plantuml-server/)
Expand Down