Skip to content
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

feat: container image #27

Open
wants to merge 1 commit 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
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:18 AS build

WORKDIR /opt/node_app

COPY package.json yarn.lock ./
RUN yarn --ignore-optional --network-timeout 600000

ARG NODE_ENV=production

COPY . .
RUN yarn build

FROM nginx:1.21-alpine

COPY --from=build /opt/node_app/dist /opt/node_app/index.html /usr/share/nginx/html/
Comment on lines +11 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this will be a playground image, we need to change the command to yarn build:playground, and copying of the files needs to be done from the /public folder (bundle will correctly make chunks for current library). This should solve the image problem.

Suggested change
RUN yarn build
FROM nginx:1.21-alpine
COPY --from=build /opt/node_app/dist /opt/node_app/index.html /usr/share/nginx/html/
RUN yarn build:playground
FROM nginx:1.21-alpine
COPY --from=build /opt/node_app/public /usr/share/nginx/html/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rgarrigue can you try applying the suggested changes by @igorwessel above and it should work



HEALTHCHECK CMD wget -q -O /dev/null http://localhost || exit 1
53 changes: 53 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<script src="/index.js"></script>
<title>Mermaid to Excalidraw</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="/index.css" />
</head>
<body>
<section id="custom-test">
<h1>Custom Test</h1>
<br />
<textarea
id="mermaid-input"
rows="10"
cols="50"
placeholder="Input Mermaid Syntax"
></textarea
><br />
<label for="font-size-input">Custom Font Size: </label>
<input type="number" id="font-size-input" value="20" /><br />
<button id="render-excalidraw-btn">Render to Excalidraw</button>
<div id="custom-diagram"></div>
<details id="parsed-data-details">
<summary>Parsed data from parseMermaid</summary>
<pre id="custom-parsed-data"></pre>
</details>
<div id="error"></div>
</section>
<img
src="/spinner.gif"
alt="Loading Spinner"
id="diagram-loading-spinner"
width="50"
/>
<div id="flowchart-container"></div>
<div id="unsupported"></div>
<script
crossorigin
src="https://unpkg.com/react@18/umd/react.development.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"
></script>
<script
crossorigin
src="https://unpkg.com/@excalidraw/[email protected]/dist/excalidraw.development.js"
></script>
<script src="/index.js" defer></script>
</body>
</html>

Loading