Skip to content

Commit bd8c618

Browse files
committed
feat: Docker Production Build
1 parent bacd186 commit bd8c618

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
shamefully-hoist=true
2+
strict-peer-dependencies=false

Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:16-alpine as build-stage
2+
3+
WORKDIR /app
4+
RUN corepack enable
5+
6+
COPY .npmrc package.json pnpm-lock.yaml ./
7+
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
8+
pnpm install --frozen-lockfile
9+
10+
COPY . .
11+
RUN pnpm build
12+
13+
FROM nginx:stable-alpine as production-stage
14+
15+
COPY --from=build-stage /app/dist /usr/share/nginx/html
16+
EXPOSE 80
17+
18+
CMD ["nginx", "-g", "daemon off;"]

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,23 @@ pnpm run build
126126
```
127127

128128
And you will see the generated file in `dist` that ready to be served.
129+
130+
131+
### Deploy on Netlify
132+
133+
Go to [Netlify](https://app.netlify.com/start) and select your clone, `OK` along the way, and your App will be live in a minute.
134+
135+
### Docker Production Build
136+
137+
First, build the vite-boot image by opening the terminal in the project's root directory.
138+
139+
```bash
140+
docker buildx build . -t viteboot:latest
141+
```
142+
143+
Run the image and specify port mapping with the `-p` flag.
144+
145+
```bash
146+
docker run --rm -it -p 8080:80 viteboot:latest
147+
```
148+

README.zh-CN.md

+20
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,23 @@ pnpm run build
122122
```
123123

124124
然后你会看到用于发布的 `dist` 文件夹被生成。
125+
126+
127+
### 部署到 Netlify
128+
129+
前往 [Netlify](https://app.netlify.com/start) 并选择你的仓库, 一路 `OK` 下去,稍等一下后,你的应用将被创建.
130+
131+
### Docker Production Build
132+
133+
首先,在项目的根目录下打开终端,构建vite-boot镜像。
134+
135+
```bash
136+
docker buildx build . -t viteboot:latest
137+
```
138+
139+
运行镜像,用 "-p" 指定端口映射。
140+
141+
```bash
142+
docker run --rm -it -p 8080:80 viteboot:latest
143+
```
144+

0 commit comments

Comments
 (0)