apache / apache/answer-plugins

Docker build with plugin from answer base image always gets stuck here and does not proceed.

オープン
#242 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
131
フォーク
75
PR マージ指標
30日以内にマージされた PR はありません

説明

when I build with plugin in docker. the docker file like this:
```
# 第一阶段:使用 answer-builder 构建 answer
FROM apache/answer as answer-builder

# 第二阶段:使用 golang 构建插件和新的 answer
FROM golang:1.19-alpine AS golang-builder

# 设置国内 Go 模块代理
ENV GOPROXY=https://goproxy.cn,direct

# 复制 answer 可执行文件
# set alpine linux 代理
COPY --from=answer-builder /usr/bin/answer /usr/bin/answer
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

# 安装构建所需依赖和 pnpm
RUN apk --no-cache add \
build-base git bash nodejs npm go && \
npm config set registry https://registry.npmmirror.com && \
npm install -g pnpm@8.9.2 && \
pnpm config set registry https://registry.npmmirror.com && \
echo "Dependencies installed successfully"

# 增加 npm 和 pnpm 的超时时间和重试次数
RUN npm config set fetch-retries 5 && \
npm config set fetch-retry-mintimeout 20000 && \
npm config set fetch-retry-maxtimeout 120000 && \
pnpm config set fetch-retries 5 && \
pnpm config set fetch-retry-mintimeout 20000 && \
pnpm config set fetch-retry-maxtimeout 120000

# 启用缓存机制,避免重复下载依赖
RUN npm config set cache /root/.npm-cache --global && \
pnpm config set store-dir /root/.pnpm-store

# 强制更新 Browserslist 数据库,使用国内的 npm 镜像
RUN npm config set registry https://registry.npmmirror.com && \
npx update-browserslist-db@latest || true

# 使用 answer build 构建插件并输出新的 answer
RUN answer build \
--with github.com/apache/incubator-answer-plugins/user-center-wecom \
--output /usr/bin/new_answer \
&& ls -l /usr/bin/new_answer

# 第三阶段:最终构建镜像
FROM alpine
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
LABEL maintainer="linkinstar@apache.org"

# 设置默认时区为 Asia/Shanghai
ARG TIMEZONE
ENV TIMEZONE=${TIMEZONE:-"Asia/Shanghai"}

# 安装基础依赖和设置时区
RUN apk update \
&& apk --no-cache add \
bash \
ca-certificates \
curl \
dumb-init \
gettext \
openssh \
sqlite \
gnupg \
tzdata \
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone

# 复制新构建的 answer 可执行文件和其他必要文件
COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
COPY --from=answer-builder /data /data
COPY --from=answer-builder /entrypoint.sh /entrypoint.sh

# 设置 entrypoint 脚本的执行权限
RUN chmod 755 /entrypoint.sh

# 挂载 /data 目录
VOLUME /data

# 暴露 80 端口
EXPOSE 80

# 设置 entrypoint
ENTRYPOINT ["/entrypoint.sh"]
````

the process always stuck here.

```
=> [answer golang-builder 8/8] RUN answer build --with github.com/apache/incubator-answer-plugins/user-center-wecom --output /usr/bin/new_answer && ls -l /usr/bin/new_answer 1302.2s
=> => # > answer-static@0.1.0 build /go/answer_build43967365/vendor/github.com/apache/incubator-answer/ui
=> => # > node ./scripts/env.js && react-app-rewired build
=> => # Creating an optimized production build...
=> => # Browserslist: caniuse-lite is outdated. Please run:
=> => # npx update-browserslist-db@latest
=> => # Why you should do it regularly: https://github.com/browserslist/update-db#readme
```
Because I am in China, so reference to the official configuration file, I have added a lot of proxy settings, does this have anything to do with the unsuccessful build?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

提供されたマルチステージ Dockerfile を再現し、エントリーポイント `answer build --with ... --output /usr/bin/new_answer` から開始します。`answer-static` と `react-app-rewired build` 周辺のビルド出力を比較し、その後、コマンドが完了して `/usr/bin/new_answer` が作成され、ハングしないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, go, node.js
領域
build-system, devops
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。