LinkinStars commented on issue #1317:
URL: https://github.com/apache/answer/issues/1317#issuecomment-2827057658

   @hhhguany 
   
   First of all your dockerfile file itself should be fine, I can build 
successfully using your dockerfile.
   
   ```bash
   #19 189.9 try to merge i18n files
   #19 189.9 i18n dir:  
/go/answer_build2141032029/vendor/github.com/apache/answer-plugins/connector-basic/i18n
   #19 189.9 i18n dir:  
/go/answer_build2141032029/vendor/github.com/apache/answer-plugins/editor-chart/i18n
   #19 189.9 i18n dir:  
/go/answer_build2141032029/vendor/github.com/apache/answer-plugins/editor-formula/i18n
   #19 189.9 [go build -ldflags -X github.com/apache/answer/cmd.Version=1.4.2 
-X github.com/apache/answer/cmd.Revision=0fd7e81 -X 
github.com/apache/answer/cmd.Time=1738833484 -o /usr/bin/new_answer .]
   #19 213.3 build new answer successfully /usr/bin/new_answer
   #19 DONE 214.3s
   ```
   
   Second, I tested the build failure scenario, and it shows the following log, 
as you said. But it doesn't say without error, the specific error is displayed.
   
   ```bash
   #17 51.20 go: downloading github.com/hpcloud/tail v1.0.0
   #17 51.22 go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
   #17 51.22 go: downloading gopkg.in/fsnotify.v1 v1.4.7
   #17 51.86 go: finding module for package 
github.com/apache/2answer-plugins/connector-basic
   #17 51.86 go: answer imports
   #17 51.86    github.com/apache/2answer-plugins/connector-basic: cannot find 
module providing package github.com/apache/2answer-plugins/connector-basic: 
module github.com/apache/2answer-plugins/connector-basic: git ls-remote -q 
origin in 
/go/pkg/mod/cache/vcs/60759bf653fee35ec73d421452c1cd00c2bfecbe55d3c855a2c266a891cd8e5b:
 exit status 128:
   #17 51.86    fatal: could not read Username for 'https://github.com': 
terminal prompts disabled
   #17 51.86 Confirm the import path was entered correctly.
   #17 51.86 If this is a private repository, see 
https://golang.org/doc/faq#git_https for additional information.
   #17 51.88 build failed exit status 1
   #17 DONE 52.9s
   
   #18 [stage-2 4/7] COPY --from=golang-builder /usr/bin/new_answer 
/usr/bin/answer
   #18 ERROR: failed to calculate checksum of ref 
e472f1a6-c909-4649-abdc-963439566abf::lkovejz5wxyrrmz5flqnn6ht8: 
"/usr/bin/new_answer": not found
   ------
    > [stage-2 4/7] COPY --from=golang-builder /usr/bin/new_answer 
/usr/bin/answer:
   ------
   Dockerfile:45
   --------------------
     43 |         && echo "${TIMEZONE}" > /etc/timezone
     44 |     
     45 | >>> COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
     46 |     COPY --from=answer-builder /data /data
     47 |     COPY --from=answer-builder /entrypoint.sh /entrypoint.sh
   --------------------
   ERROR: failed to solve: failed to compute cache key: failed to calculate 
checksum of ref 
e472f1a6-c909-4649-abdc-963439566abf::lkovejz5wxyrrmz5flqnn6ht8: 
"/usr/bin/new_answer": not found
   ```
   
   Third, your suggestion is great. It should just return an error exit 
code(exit 1) when the `answer build` fails to stop directly. It should be 
stopped directly on the answer build command, and should not execute Docker 
COPY.
   
   
   
   @sy-records 
   
   ```
   RUN answer build \
       --with github.com/apache/answer-plugins/connector-basic \
       --with github.com/apache/answer-plugins/editor-chart \
       --with github.com/apache/answer-plugins/editor-formula \
       --output /usr/bin/new_answer
   ```
   
   The author's question is not really about whether the `output` option is 
supported. His real problem is that the build fails without stopping 
immediately, causing the subsequent steps to execute abnormally. The `docker 
build` command he used may have swallowed the error logs, leaving him with no 
way to locate the build issue, I guess.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@answer.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to