diff --git a/Dockerfile b/Dockerfile index a8bd167..cfb6496 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Jenkinsfile b/Jenkinsfile index 6ed5d70..149eb9c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,8 @@ pipeline { agent any environment { - APP_NAME = 'no-whatever' + 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 """