mirror of
https://github.com/sendevia/website.git
synced 2026-03-05 23:32:45 +08:00
Compare commits
8 Commits
a7e0528c24
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9677ac1367 | |||
| b41cea0bed | |||
| 8345515977 | |||
| dd069771a8 | |||
| e4217512aa | |||
| 93a42ec037 | |||
| d489bf24c4 | |||
| 67a26def4f |
5
.github/workflows/docker-build.yml
vendored
5
.github/workflows/docker-build.yml
vendored
@@ -29,6 +29,8 @@ jobs:
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v4
|
||||
@@ -61,5 +63,4 @@ jobs:
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
no-cache: true
|
||||
|
||||
@@ -174,7 +174,9 @@ if (isClient()) {
|
||||
<template>
|
||||
<nav class="NavBar" :class="navClass">
|
||||
<div class="fab-container">
|
||||
<MaterialButton color="text" :icon="navStateStore.isNavExpanded ? 'menu_open' : 'menu'" @click="toggleNav" />
|
||||
<ClientOnly>
|
||||
<MaterialButton color="text" :icon="navStateStore.isNavExpanded ? 'menu_open' : 'menu'" @click="toggleNav" />
|
||||
</ClientOnly>
|
||||
<button class="fab" @mousedown.prevent @click.stop="toggleSearch">
|
||||
<span>{{ searchStateStore.isSearchActive ? "close" : "search" }}</span>
|
||||
<p :ref="(el) => setLabelRef(el, '.fab')">搜索</p>
|
||||
@@ -202,15 +204,17 @@ if (isClient()) {
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<MaterialButton
|
||||
class="theme-btn"
|
||||
size="m"
|
||||
color="text"
|
||||
:title="themeStateStore.currentLabel"
|
||||
:icon="themeStateStore.currentIcon"
|
||||
@click="toggleTheme"
|
||||
>
|
||||
</MaterialButton>
|
||||
<ClientOnly>
|
||||
<MaterialButton
|
||||
class="theme-btn"
|
||||
size="m"
|
||||
color="text"
|
||||
:title="themeStateStore.currentLabel"
|
||||
:icon="themeStateStore.currentIcon"
|
||||
@click="toggleTheme"
|
||||
>
|
||||
</MaterialButton>
|
||||
</ClientOnly>
|
||||
</div>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
@@ -142,15 +142,15 @@ if (isClient()) {
|
||||
<PrevNext />
|
||||
</main>
|
||||
<aside id="article-aside">
|
||||
<div class="post-info">
|
||||
<p v-if="frontmatter.description" class="description">{{ frontmatter.description }}</p>
|
||||
<p v-if="formattedPublishDate" class="date-publish">发布于 {{ formattedPublishDate }}</p>
|
||||
<ClientOnly>
|
||||
<ClientOnly>
|
||||
<div class="post-info">
|
||||
<p v-if="frontmatter.description" class="description">{{ frontmatter.description }}</p>
|
||||
<p v-if="formattedPublishDate" class="date-publish">发布于 {{ formattedPublishDate }}</p>
|
||||
<p v-if="formattedLastUpdated" :title="lastUpdatedRawTime" class="date-update">
|
||||
{{ formattedLastUpdated }}
|
||||
</p>
|
||||
</ClientOnly>
|
||||
</div>
|
||||
</div>
|
||||
</ClientOnly>
|
||||
<ButtonGroup v-if="frontmatter?.external_links" :links="frontmatter.external_links" size="m" layout="vertical" />
|
||||
<PageIndicator />
|
||||
</aside>
|
||||
|
||||
37
Caddyfile
Normal file
37
Caddyfile
Normal file
@@ -0,0 +1,37 @@
|
||||
:80 {
|
||||
# 根目录指向构建产物
|
||||
root * /app
|
||||
|
||||
# 关闭访问日志
|
||||
log {
|
||||
output discard
|
||||
}
|
||||
|
||||
# 启用压缩
|
||||
encode gzip zstd
|
||||
|
||||
# 文件服务器配置
|
||||
try_files {path} {path}.html {path}/
|
||||
file_server
|
||||
|
||||
# 错误页面处理
|
||||
handle_errors {
|
||||
@404 {
|
||||
expression {http.error.status_code} == 404
|
||||
}
|
||||
@403 {
|
||||
expression {http.error.status_code} == 403
|
||||
}
|
||||
rewrite @404 /404.html
|
||||
rewrite @403 /404.html
|
||||
file_server
|
||||
}
|
||||
|
||||
# 静态资源缓存配置
|
||||
@assets {
|
||||
path /assets/*
|
||||
}
|
||||
header @assets {
|
||||
Cache-Control "public, immutable, max-age=31536000"
|
||||
}
|
||||
}
|
||||
16
Dockerfile
16
Dockerfile
@@ -9,19 +9,19 @@ RUN apt-get update && apt-get install -y git \
|
||||
WORKDIR /app
|
||||
|
||||
# 拉取项目代码
|
||||
RUN git clone https://github.com/sendevia/website .
|
||||
RUN git clone https://github.com/sendevia/website . --depth=1
|
||||
|
||||
# 安装依赖并构建
|
||||
RUN npm i && npm run docs:build
|
||||
|
||||
# 最终阶段
|
||||
FROM nginx:stable-perl
|
||||
FROM caddy:alpine AS final
|
||||
|
||||
# 从构建阶段复制 dist 产物到 workdir
|
||||
COPY --from=builder /app/.vitepress/dist /app/dist
|
||||
# 从构建阶段复制 dist 产物到工作目录
|
||||
COPY --from=builder /app/.vitepress/dist /app
|
||||
|
||||
# 暴露端口(80 HTTP 和 443 HTTPS)
|
||||
EXPOSE 80 443
|
||||
# 复制Caddyfile配置文件
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
|
||||
# 启动 nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
# 启动Caddy服务器
|
||||
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "26.3.4(316)",
|
||||
"version": "26.3.5(323)",
|
||||
"scripts": {
|
||||
"update-version": "bash ./scripts/update-version.sh",
|
||||
"docs:dev": "vitepress dev",
|
||||
|
||||
Reference in New Issue
Block a user