feat: 注入高德地图 API Key 到 Docker 构建和运行环境

This commit is contained in:
2026-02-25 14:30:24 +08:00
parent 6ceedddce9
commit 77914672e0
2 changed files with 6 additions and 2 deletions
+2
View File
@@ -14,6 +14,8 @@ FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG NEXT_PUBLIC_AMAP_API_KEY
ENV NEXT_PUBLIC_AMAP_API_KEY=${NEXT_PUBLIC_AMAP_API_KEY}
RUN npx prisma generate
ENV DATABASE_URL="file:./template.db"
RUN npx prisma db push
Vendored
+3 -1
View File
@@ -3,6 +3,7 @@ pipeline {
environment {
APP_NAME = 'no-whatever'
AMAP_KEY = '7f6be40a6de3f7fbb7bc3f825b67573b'
}
triggers {
@@ -18,7 +19,7 @@ pipeline {
stage('Build Docker Image') {
steps {
sh "docker build -t ${APP_NAME}:${BUILD_NUMBER} -t ${APP_NAME}:latest ."
sh "docker build --build-arg NEXT_PUBLIC_AMAP_API_KEY=${AMAP_KEY} -t ${APP_NAME}:${BUILD_NUMBER} -t ${APP_NAME}:latest ."
}
}
@@ -34,6 +35,7 @@ pipeline {
-p 3000:3000 \
-v /data/${APP_NAME}:/app/data \
-e DATABASE_URL=file:/app/data/prod.db \
-e AMAP_API_KEY=${AMAP_KEY} \
--restart unless-stopped \
${APP_NAME}:latest
"""