diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f32a5e8 --- /dev/null +++ b/Dockerfile @@ -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/ . diff --git a/README.md b/README.md index cd19d7a..2e6ebbc 100644 --- a/README.md +++ b/README.md @@ -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/)