-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
Building a custom Answer image with plugins fails due to the output binary (/usr/bin/new_answer
) not being found after running the answer build
command inside a Docker multi-stage build.
Even though the answer build
command completes without error, the expected output binary /usr/bin/new_answer
does not appear to be created, resulting in a COPY
failure in the final stage of the Dockerfile.
To Reproduce
Steps to reproduce the behavior:
- Create a multi-stage Dockerfile to build Answer with plugins (see example below).
- Run
docker build .
- Build runs successfully up to the
answer build
step. - Docker fails on the line
COPY --from=golang-builder /usr/bin/new_answer /usr/bin/answer
with an error:"/usr/bin/new_answer": not found
.
# https://answer.apache.org/docs/plugins/
FROM apache/answer:latest as answer-builder
FROM golang:1.22-alpine AS golang-builder
COPY --from=answer-builder /usr/bin/answer /usr/bin/answer
RUN apk --no-cache add \
build-base git bash nodejs npm go && \
npm install -g pnpm@8.9.2
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
FROM alpine
LABEL maintainer="linkinstar@apache.org"
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
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
RUN chmod 755 /entrypoint.sh
VOLUME /data
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
Expected behavior
The answer build
command should produce the specified output binary at /usr/bin/new_answer
, which can then be copied into the final image layer.
Screenshots
N/A — see CLI output:
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref ...: "/usr/bin/new_answer": not found
Platform
- Device: Desktop
- OS: CentOS 7 (Docker host)
- Docker version: 24.0.5
- Answer version: v1.4.5
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers