brucefan1983-cuda-programming
RUNNING
History Source
SummaryIterations1Transcript4Dockerfile
01Iteration 1
WRITEWriteFile· step #1
0s
Dockerfile1258 bytes written
text38 lines · 1258 chars
# Multi-stage build to compile with CUDA toolkit, then provide a lightweight runtime image

# Builder stage: CUDA toolkit (devel) image to compile the project variants
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 AS builder
WORKDIR /workspace

# Copy the repository into the build context
COPY . .

# Install essential build tools
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        build-essential \
    && rm -rf /var/lib/apt/lists/*

# Build both variants of the project
RUN make -C src/13-md/whole-code
RUN make -C src/13-md/force-only

# Runtime stage: provide a lightweight Ubuntu on which the binaries can be executed
FROM ubuntu:jammy-20260210.1 AS runtime
WORKDIR /workspace

# Minimal runtime setup (no CUDA runtime installed by default here)
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Copy built executables from the builder
COPY --from=builder /workspace/src/13-md/whole-code/ljmd /usr/local/bin/ljmd_whole
COPY --from=builder /workspace/src/13-md/force-only/ljmd /usr/local/bin/ljmd_force

# Entrypoint wrapper to select which variant to run
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
WRITEWriteFile· step #2
0s
.dockerignore179 bytes written
dockerignore20 lines · 179 chars
# Ignore version control and local build artefacts
.git
.gitignore
node_modules/
build/
dist/
*.o
*.obj
*.so
*.a
*.log
*.tmp
*.dll
*.exe
*.dylib
*.pyc
__pycache__/
*.md
README.md
WRITEWriteFile· step #3
0s
entrypoint.sh253 bytes written
sh17 lines · 253 chars
#!/bin/sh
set -e

VARIANT=${1:-whole}
case "$VARIANT" in
  whole)
    exec /usr/local/bin/ljmd_whole "$2" "$3"
    ;;
  force)
    exec /usr/local/bin/ljmd_force "$2" "$3"
    ;;
  *)
    echo "Usage: $0 {whole|force} [args]" >&2
    exit 1
    ;;
esac
VERIFYVerifyBuild· step #4
2m 47s
VerifyBuildsmoke_failed
Concerns: Runtime image lacks CUDA runtime libraries; the built binaries may depend on CUDA shared libraries (e.g., libcudart, libcuda) and could fail to run in the final image., Using a non-official Ubuntu tag ubuntu:jammy-20260210.1 could affect reproducibility or accessibility; consider using a standard tag like ubuntu:22.04 and install any needed packages explicitly.
Smoke [FAIL]: test -x /usr/local/bin/ljmd_whole && /usr/local/bin/ljmd_whole --version
  Output: Usage: /usr/local/bin/ljmd_whole nx Ne

Smoke [FAIL]: test -x /usr/local/bin/ljmd_force && /usr/local/bin/ljmd_force --version
  Output: Usage: /usr/local/bin/ljmd_force nx Ne