Repository navigation
Docker build fails with: version "v2.0.0" invalid: should be v0 or v1, not v2 #1514
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Custom build using ANSWER_MODULE failing with: replace github.com/apache/answer: version "v2.0.0" invalid: should be v0 or v1, not v2
To Reproduce
Steps to reproduce the behavior:
- Specify
ARG ANSWER_MODULE=github.com/apache/[email protected]and build apache answer - See build fail with error
Expected behavior
A working build.
CI/CD log
#15 43.92 go: downloading github.com/apache/answer-plugins/reviewer-basic v1.0.8
#15 44.20 go: added github.com/apache/answer-plugins/reviewer-basic v1.0.8
#15 44.21 [go mod edit -replace github.com/apache/answer=github.com/apache/[email protected]]
#15 44.23 [go mod tidy]
#15 44.24 go: errors parsing go.mod:
#15 44.24 go.mod:73: replace github.com/apache/answer: version "v2.0.0" invalid: should be v0 or v1, not v2
#15 44.24 build failed exit status 1
#15 ERROR: process "/bin/bash -c /scripts/build.sh" did not complete successfully: exit code: 1
Dockerfile
# Initialize /usr/bin/answer
# INFO: Replace version
FROM docker.io/apache/answer:2.0.0 AS answer-builder
# INFO: Replace version
FROM code.forgejo.org/oci/golang:1.26-alpine3.23 AS golang-builder
COPY --from=answer-builder /usr/bin/answer /usr/bin/answer
# Set build time variables
# INFO: Replace version
ARG PNPM_VERSION=10.32.1
ARG ANSWER_MODULE=github.com/apache/[email protected]
# Install dependencies
RUN apk --no-cache add \
build-base git bash nodejs npm go && \
npm install -g pnpm@${PNPM_VERSION}
# Build /usr/bin/new_answer
COPY scripts/ /scripts
RUN chmod 755 /scripts/*.sh
RUN ["/bin/bash","-c","/scripts/build.sh"]
# Defaults from https://github.com/apache/answer/blob/main/Dockerfile
# INFO: Replace version
FROM code.forgejo.org/oci/alpine:latest
LABEL maintainer="[email protected]"
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
# Defaults from https://answer.apache.org/docs/plugins/#build-with-plugin-from-answer-base-image
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
ENTRYPOINT ["/entrypoint.sh"]
Problem
As far as I understand, go requires a /v2 suffix after a major version bump. Also see this.
If you want met to submit a PR, please let me know, but I think this is better handled by maintainers. Also my understanding of go is limited so this problem description might not be 100% accurate.
Platform
- Device: n.a
- OS: n.a
- Browser and version: n.a
- Version: v2.0.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
comments: Add FIXME for module bug
LinkinStars commentedon Mar 14, 2026
If you have already set
FROM docker.io/apache/answer:2.0.0 AS answer-builder, then you don't actually need to setARG ANSWER_MODULE=github.com/apache/[email protected]since you're already building on top of version 2.0.0. That said, I’ll continue to follow up on this issue to see how it should be handled.