Skip to content

Commit 8d166d8

Browse files
committed
feat(docker): docker部署方式
1 parent 5d78356 commit 8d166d8

6 files changed

+49
-3
lines changed

.dockerignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# path: ./.dockerignore
2+
3+
.DS_Store
4+
node_modules
5+
dist
6+
.npmrc
7+
yarn.lock
8+
pnpm-lock.yaml
9+
package-lock.json

.env

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
APP_TITLE=快图设计-开源在线设计工具-vue-fabric-editor
2+
APP_BASE_PATH=/vue-fabric-editor/
23
APP_APIHOST=https://www.kuaitu.cc
34
APP_ADMINAPIHOST=https://www.kuaitu.cc/admin

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:18-alpine3.18 as build
2+
3+
WORKDIR /app
4+
COPY . .
5+
6+
RUN npm install -g pnpm --registry=https://registry.npmmirror.com
7+
RUN pnpm install
8+
9+
RUN ["pnpm", "build"]
10+
11+
FROM nginx:stable-alpine
12+
COPY --from=0 /app/dist /usr/share/nginx/html/
13+
COPY nginx.conf /etc/nginx/conf.d/

docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3'
2+
services:
3+
kuaitu:
4+
container_name: kuaitu
5+
build: ./
6+
ports:
7+
- '8888:80'

nginx.conf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
location / {
6+
root /usr/share/nginx/html;
7+
index index.html;
8+
try_files $uri $uri/ /index.html;
9+
}
10+
11+
error_page 500 502 503 504 /50x.html;
12+
location = /50x.html {
13+
root /usr/share/nginx/html;
14+
}
15+
}

vite.config.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Author: June
55
* @Date: 2023-04-24 00:25:39
66
* @LastEditors: 秦少卫
7-
* @LastEditTime: 2024-06-07 11:45:43
7+
* @LastEditTime: 2024-06-11 10:55:13
88
*/
99
import { defineConfig, loadEnv } from 'vite';
1010
import vue from '@vitejs/plugin-vue';
@@ -19,9 +19,10 @@ import autoprefixer from 'autoprefixer';
1919
const config = ({ mode }) => {
2020
const isProd = mode === 'production';
2121
const envPrefix = 'APP_';
22-
const { APP_TITLE = '' } = loadEnv(mode, process.cwd(), envPrefix);
22+
const { APP_TITLE = '', APP_PATH } = loadEnv(mode, process.cwd(), envPrefix);
23+
console.log(APP_PATH, 111);
2324
return {
24-
base: isProd ? '/vue-fabric-editor/' : '/',
25+
base: isProd ? APP_PATH : '/',
2526
plugins: [
2627
vue(),
2728
autoImports({

0 commit comments

Comments
 (0)