Skip to content

Commit

Permalink
feat(docker): docker部署方式
Browse files Browse the repository at this point in the history
  • Loading branch information
nihaojob committed Jun 11, 2024
1 parent 5d78356 commit 8d166d8
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# path: ./.dockerignore

.DS_Store
node_modules
dist
.npmrc
yarn.lock
pnpm-lock.yaml
package-lock.json
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
APP_TITLE=快图设计-开源在线设计工具-vue-fabric-editor
APP_BASE_PATH=/vue-fabric-editor/
APP_APIHOST=https://www.kuaitu.cc
APP_ADMINAPIHOST=https://www.kuaitu.cc/admin
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:18-alpine3.18 as build

WORKDIR /app
COPY . .

RUN npm install -g pnpm --registry=https://registry.npmmirror.com
RUN pnpm install

RUN ["pnpm", "build"]

FROM nginx:stable-alpine
COPY --from=0 /app/dist /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/conf.d/
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:
kuaitu:
container_name: kuaitu
build: ./
ports:
- '8888:80'
15 changes: 15 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
7 changes: 4 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @Author: June
* @Date: 2023-04-24 00:25:39
* @LastEditors: 秦少卫
* @LastEditTime: 2024-06-07 11:45:43
* @LastEditTime: 2024-06-11 10:55:13
*/
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
Expand All @@ -19,9 +19,10 @@ import autoprefixer from 'autoprefixer';
const config = ({ mode }) => {
const isProd = mode === 'production';
const envPrefix = 'APP_';
const { APP_TITLE = '' } = loadEnv(mode, process.cwd(), envPrefix);
const { APP_TITLE = '', APP_PATH } = loadEnv(mode, process.cwd(), envPrefix);
console.log(APP_PATH, 111);
return {
base: isProd ? '/vue-fabric-editor/' : '/',
base: isProd ? APP_PATH : '/',
plugins: [
vue(),
autoImports({
Expand Down

0 comments on commit 8d166d8

Please sign in to comment.