-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
117 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
name: Deploy to Server | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
DOCKER_IMAGE: | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build the Docker image | ||
run: docker build -t weilai.team:${{ github.sha }} . | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,37 @@ | ||
# 构建阶段 | ||
|
||
# 使用 bun 镜像作为构建基础镜像 | ||
FROM oven/bun:alpine AS build | ||
|
||
# 设置目录为 /app | ||
WORKDIR /app | ||
|
||
# 将 package 文件复制到镜像中 | ||
COPY package*.json ./ | ||
|
||
# 安装依赖 | ||
RUN bun install | ||
|
||
# 复制所有源代码到镜像中 | ||
COPY . . | ||
|
||
# 构建 Vue 项目 | ||
RUN bun run build | ||
|
||
# 运行阶段 | ||
|
||
# 使用 nginx 镜像作为运行时基础镜像 | ||
FROM nginx:alpine | ||
|
||
# 从构建阶段的镜像中复制构建好的静态文件到 nginx 的默认静态文件目录中 | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
# 复制自定义的 Nginx 配置文件到 Nginx 的配置目录 | ||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
|
||
# 暴露 80 端口 | ||
EXPOSE 80 | ||
|
||
# 启动 Nginx 并保持在前台运行 | ||
CMD [ "nginx", "-g", "daemon off;" ] | ||
|
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,24 @@ | ||
server { | ||
listen 80; | ||
server_name your-domain.com; # 你的域名 | ||
|
||
root /usr/share/nginx/html; # Vue 应用打包后的文件存放目录 | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
location /api/ { | ||
proxy_pass http://backend-service; # 后端 API 的地址 | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
</script> | ||
|
||
<template> | ||
ds | ||
|
||
</template> | ||
|
||
<style lang="scss" scoped></style> |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import { createApp } from "vue"; | ||
import App from "./App.vue"; | ||
|
||
createApp(App).mount('#app') | ||
createApp(App).mount("#app"); |
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 @@ | ||
{"root":["./src/main.ts","./src/vite-env.d.ts","./src/api/index.ts","./src/modules/console/main.ts","./src/modules/recruitment/main.ts","./src/app.vue","./src/modules/console/app.vue","./src/modules/recruitment/app.vue"],"version":"5.6.3"} |
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 |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import { defineConfig } from "vite"; | ||
import vue from "@vitejs/plugin-vue"; | ||
import path, { resolve } from "node:path"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [vue()], | ||
build: { | ||
rollupOptions: { | ||
input: {} | ||
input: { | ||
main: path.resolve(__dirname, "./index.html"), | ||
console: path.resolve(__dirname, "./src/modules/console/index.html"), | ||
recruitment: path.resolve( | ||
__dirname, | ||
"./src/modules/recruitment/index.html", | ||
), | ||
}, | ||
}, | ||
}, | ||
}); |