Skip to content

Commit

Permalink
显示版本号
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed Apr 22, 2024
1 parent 72f692c commit 1015ab0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Nuxt 3 builder
FROM node:20.12.1-alpine as builder

ARG VERSION

WORKDIR /app

COPY package*.json ./
Expand All @@ -14,6 +16,8 @@ COPY . .
# 生成Prisma客户端
RUN npx prisma generate

RUN echo $VERSION > /app/version

ENV NODE_ENV=production

# 构建Nuxt应用
Expand All @@ -27,10 +31,12 @@ WORKDIR /app
ENV NODE_ENV=production
ENV DATABASE_URL="file:/app/data/db.sqlite"
ENV UPLOAD_DIR="/app/data/upload"
ENV MOMENTS_VERSION=$VERSION

COPY --from=builder /app/.output /app/.output
COPY --from=builder /app/prisma /app/prisma
COPY --from=builder /app/start.sh /app/start.sh
COPY --from=builder /app/version /app/version

RUN mkdir -p /app/data/upload

Expand Down
6 changes: 6 additions & 0 deletions pages/settings.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<div class="flex flex-col gap-4 p-2 sm:p-4">
<div class="flex flex-col gap-2">
<Label for="title" class="text-right text-gray-400 text-xs my-2" v-if="version">版本号:{{ version }}</Label>

</div>
<div class="flex flex-col gap-2">
<Label for="title" class="font-bold">管理员账号</Label>
<Input type="text" id="title" placeholder="管理员账号" autocomplete="off" v-model="state.username" />
Expand Down Expand Up @@ -118,6 +122,8 @@ const token = useCookie('token')
import { useStorage } from "@vueuse/core";
import type { User } from '~/lib/types';
const version = process.env.VERSION||''
const userinfo = useState<User>('userinfo')
useHead({
Expand Down
2 changes: 2 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

mkdir -p /app/data/upload
npx prisma migrate deploy

export VERSION=$(cat /app/version)
node /app/.output/server/index.mjs > output.log 2>&1

0 comments on commit 1015ab0

Please sign in to comment.