apache-rocketmq
SUCCESS
13m 14s
History Source
SummaryIterations1Transcript7Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile1542 chars
text49 lines · 1542 chars
# Multi-stage Dockerfile to build Apache RocketMQ from source and provide a runnable runtime
# Stage 1: builder - install Java and Bazelisk to build the repository from source
FROM openjdk:8-jdk-slim AS builder

# Essential utilities
RUN apt-get update -y \
    && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
        git \
        unzip \
        bash \
    && rm -rf /var/lib/apt/lists/*

# Install Bazelisk (a Bazel wrapper) and expose `bazel` command
RUN curl -Lo /usr/local/bin/bazelisk \
        https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64 \
    && chmod +x /usr/local/bin/bazelisk \
    && ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel

# Set working directory and copy source
WORKDIR /workspace
COPY . /workspace

# Verify Bazel version (will download Bazel as needed by bazelisk)
RUN bazel --version || true

# Build the repository from source (may take a while, depending on network and cache)
RUN bazel build //...

# Stage 2: runtime
FROM openjdk:8-jre-slim

# Optional: keep the same user context
RUN useradd -m rocketmq
USER rocketmq

WORKDIR /workspace

# Copy build outputs (bazel-bin and related) from builder stage if present
COPY --from=builder /workspace/bazel-bin /workspace/bazel-bin
COPY --from=builder /workspace/bazel-out /workspace/bazel-out

# Expose common RocketMQ ports (NameServer and Broker) for convenience
EXPOSE 9876 10911

# Default to an interactive shell; user can start the broker/name server manually
CMD ["bash"]
WRITEWriteFile· step #2
0s
Dockerfile1450 chars
text48 lines · 1450 chars
# Multi-stage Dockerfile to build Apache RocketMQ from source and provide a runnable runtime
# Stage 1: builder - install Java and Bazelisk to build the repository from source
FROM openjdk:8-jdk AS builder

# Essential utilities
RUN apt-get update -y \
    && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
        git \
        unzip \
        bash \
    && rm -rf /var/lib/apt/lists/*

# Install Bazelisk (a Bazel wrapper) and expose `bazel` command
RUN curl -Lo /usr/local/bin/bazelisk \
        https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64 \
    && chmod +x /usr/local/bin/bazelisk \
    && ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel

# Set working directory and copy source
WORKDIR /workspace
COPY . /workspace

# Verify Bazel version (will download Bazel as needed by bazelisk)
RUN bazel --version || true

# Build the repository from source (may take a while, depending on network and cache)
RUN bazel build //...

# Stage 2: runtime
FROM openjdk:8-jre

# Optional: keep the same user context
RUN useradd -m rocketmq
USER rocketmq

WORKDIR /workspace

# Copy build outputs (bazel-bin and related) from builder stage if present
COPY --from=builder /workspace /workspace

# Expose common RocketMQ ports (NameServer and Broker) for convenience
EXPOSE 9876 10911

# Default to an interactive shell; user can start the broker/name server manually
CMD ["bash"]
WRITEWriteFile· step #3
0s
Dockerfile1466 bytes written
text48 lines · 1466 chars
# Multi-stage Dockerfile to build Apache RocketMQ from source and provide a runnable runtime
# Stage 1: builder - install Java and Bazelisk to build the repository from source
FROM eclipse-temurin:8-jdk AS builder

# Essential utilities
RUN apt-get update -y \
    && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
        git \
        unzip \
        bash \
    && rm -rf /var/lib/apt/lists/*

# Install Bazelisk (a Bazel wrapper) and expose `bazel` command
RUN curl -Lo /usr/local/bin/bazelisk \
        https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64 \
    && chmod +x /usr/local/bin/bazelisk \
    && ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel

# Set working directory and copy source
WORKDIR /workspace
COPY . /workspace

# Verify Bazel version (will download Bazel as needed by bazelisk)
RUN bazel --version || true

# Build the repository from source (may take a while, depending on network and cache)
RUN bazel build //...

# Stage 2: runtime
FROM eclipse-temurin:8-jre

# Optional: keep the same user context
RUN useradd -m rocketmq
USER rocketmq

WORKDIR /workspace

# Copy build outputs (bazel-bin and related) from builder stage if present
COPY --from=builder /workspace /workspace

# Expose common RocketMQ ports (NameServer and Broker) for convenience
EXPOSE 9876 10911

# Default to an interactive shell; user can start the broker/name server manually
CMD ["bash"]
WRITEWriteFile· step #4
0s
.dockerignore176 bytes written
dockerignore14 lines · 176 chars
# Ignore VCS and build artifacts
.git
.gitignore
**/node_modules
**/target
**/bazel-out
**/.bazel
**/.bazelisk-cache
**/vendor
.dockerignore
Dockerfile
.dockerignore
README.md
VERIFYVerifyBuild· step #5
2m 26s
VerifyBuildbuild_failed
Build error
- Failing command step: [builder 7/7] RUN bazel build //...
  - Exact errors:
    - ERROR: 0/workspace/auth/BUILD.bazel:70:13: //auth:src/test/java/org/apache/rocketmq/auth/authentication/builder/DefaultAuthenticationContextBuilderTest depends on @local_config_cc//:cc-compiler-k8 in repository @local_config_cc which failed to fetch. no such package '@local_config_cc//':
    - Auto-Configuration Error: Cannot find gcc or CC; either correct your path or set the CC environment variable
  - Process exit code: 1
  - Final summary line:
    - "FAILED: Build did NOT complete successfully (68 packages loaded, 427 targets configured)"
    - "process \"/bin/sh -c bazel build //...\" did not complete successfully: exit code: 1"

- Missing packages or files:
  - The error indicates GCC/CC toolchain is not available. No gcc/CC path found, CC environment variable not set.
  - The build image apt-get step installs curl, ca-certificates, git, unzip, bash, etc., but not a C/C++ toolchain (gcc/g++/build-essential), causing local_config_cc fetch failure.

- Version info:
  - Bazel-related: Bazelisk downloaded Bazel 6.5.0 and started the local Bazel server.
  - No explicit version mismatch; failure due to missing GCC/CC.
  - Java toolchain: eclipse-temurin:8-jre and 8-jdk (not implicated).
WRITEWriteFile· step #6
0s
Dockerfile1532 bytes written
text51 lines · 1532 chars
# Multi-stage Dockerfile to build Apache RocketMQ from source and provide a runnable runtime
# Stage 1: builder - install Java and Bazelisk to build the repository from source
FROM eclipse-temurin:8-jdk AS builder

# Essential utilities
RUN apt-get update -y \
    && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
        git \
        unzip \
        bash \
        build-essential \
        python3 \
        python3-pip \
    && rm -rf /var/lib/apt/lists/*

# Install Bazelisk (a Bazel wrapper) and expose `bazel` command
RUN curl -Lo /usr/local/bin/bazelisk \
        https://github.com/bazelbuild/bazelisk/releases/download/v1.12.0/bazelisk-linux-amd64 \
    && chmod +x /usr/local/bin/bazelisk \
    && ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel

# Set working directory and copy source
WORKDIR /workspace
COPY . /workspace

# Verify Bazel version (will download Bazel as needed by bazelisk)
RUN bazel --version || true

# Build the repository from source (may take a while, depending on network and cache)
RUN bazel build //...

# Stage 2: runtime
FROM eclipse-temurin:8-jre

# Optional: keep the same user context
RUN useradd -m rocketmq
USER rocketmq

WORKDIR /workspace

# Copy build outputs (bazel-bin and related) from builder stage if present
COPY --from=builder /workspace /workspace

# Expose common RocketMQ ports (NameServer and Broker) for convenience
EXPOSE 9876 10911

# Default to an interactive shell; user can start the broker/name server manually
CMD ["bash"]
VERIFYVerifyBuild· step #7
8m 11s
VerifyBuildaccepted
Concerns: Final runtime image copies /workspace from the builder stage but runs as user 'rocketmq'; the copied files may be owned by root and could lack read permissions for the non-root user. Consider running chown -R rocketmq:rocketmq /workspace in the final stage or ensure permissions are set during copy., The CMD is just bash, meaning there is no automatic startup of RocketMQ services. This is fine for a minimal runtime, but it should be documented or adjusted if automatic startup is desired., Building from source with Bazel in the image can be time-consuming and may bloat the image. If a runtime-only image is desired in practice, consider a separate runtime image or a lighter build cache strategy.
Smoke [PASS]: java -version
Smoke [PASS]: test -d /workspace && echo workspace_present || exit 1
Smoke [PASS]: find /workspace -type f -print -quit