forked from ZenUml/core
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker support for running the application (#181)
* feat: Add Docker support for running the application * fix unit test * refine docker to reduce its size
- Loading branch information
Showing
5 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
node_modules | ||
.git | ||
.gitignore | ||
.github | ||
*.md | ||
dist | ||
.watchmanconfig | ||
.prettierrc | ||
.prettierignore | ||
.editorconfig | ||
.eslintignore | ||
.eslintrc.js | ||
.git-blame-ignore-revs | ||
.vscode | ||
cypress | ||
cypress.config.ts | ||
docs | ||
test | ||
vite.config.lib.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM node:20-slim AS base | ||
|
||
# Set environment variables for pnpm | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
ENV DOCKER=true | ||
|
||
# Enable corepack to use pnpm | ||
RUN corepack enable | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy the project files to the working directory | ||
COPY . . | ||
|
||
RUN pnpm add -g serve | ||
|
||
FROM base As prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prod --ignore-scripts | ||
FROM base AS deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
FROM base AS build | ||
COPY --from=deps /app/node_modules /app/node_modules | ||
RUN pnpm build:site | ||
|
||
FROM base | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
COPY --from=build /app/dist /app/dist | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 8080 | ||
|
||
# Command to run the application | ||
CMD ["serve", "-s", "dist", "-l", "8080"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters