[linux/amd64 6/6] RUN npm run build
#16 0.925
#16 0.925 > [email protected] build
#16 0.925 > next build --no-lint
#16 0.925
#16 1.480 warn - Linting is disabled
#16 1.915 ❌ Invalid environment variables:
#16 1.915 OPENAI_API_KEY: Required
#16 1.915
#16 1.918 error - Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error
#16 1.926
#16 1.926 > Build error occurred
#16 1.929 Error: Invalid environment variables
#16 1.929 at file:///app/src/env/server.mjs:16:9
#16 1.929 at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
#16 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
#13 [linux/arm64 4/6] RUN npm ci
#13 CANCELED
------
> [linux/amd64 6/6] RUN npm run build:
#16 1.480 warn - Linting is disabled
#16 1.915 ❌ Invalid environment variables:
#16 1.915 OPENAI_API_KEY: Required
#16 1.915
#16 1.918 error - Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error
#16 1.926
#16 1.926 > Build error occurred
#16 1.929 Error: Invalid environment variables
#16 1.929 at file:///app/src/env/server.mjs:16:9
#16 1.929 at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
------
Dockerfile:21
--------------------
19 |
20 | # Build the Next.js app
21 | >>> RUN npm run build
22 |
23 | # Expose the port the app will run on
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
Error: buildx failed with: ERROR: failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
name: build_docker
on:
push:
branches: [main]
release:
types: [created] # 表示在创建新的 Release 时触发
jobs:
build_docker:
name: Build docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: |
echo "本次构建的版本为:${GITHUB_REF_NAME} (但是这个变量目前上下文中无法获取到)"
echo 本次构建的版本为:${{ github.ref_name }}
env
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
push: true
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/agent-gpt:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/agent-gpt:latest