Skip to content

Commit

Permalink
feat: 最小最快的 dockerfile 静态服务
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed Jul 4, 2023
1 parent 0452560 commit c7fb036
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dist
.husky
.gitee
.github
.vscode
LICENSE
.gitignore
netlify.toml
CHANGELOG.md
node_modules
renovate.json
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
".env": ".env.*",
"index.html": "LICENSE,.gitignore,README.md",
".eslintrc.json": ".eslint*,.prettier*,.editor*",
"vite.config.*": "package.json,uno.config.ts,tsconfig.json,*.toml,.npmrc,renovate.json,CHANGELOG.md"
"vite.config.*": "package.json,uno.config.ts,tsconfig.json,*.toml,.npmrc,renovate.json,CHANGELOG.md,.dockerignore,dockerfile"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
Expand Down
19 changes: 19 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:18-alpine AS builder

WORKDIR /app
COPY . /app/

RUN npm install pnpm -g
RUN pnpm install
RUN pnpm build

FROM pierrezemb/gostatic
COPY --from=builder /app/dist /srv/http


EXPOSE 8043

# 内部静态服务
# -fallback 用来指定 spa
CMD ["/goStatic", "-fallback" "/index.html"]

0 comments on commit c7fb036

Please sign in to comment.