FROM gcc:15.2.0
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends cmake build-essential libomp-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
COPY . /workspace
# Configure and build the project from source
RUN cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
&& cmake --build build --parallel
# Default to interactive shell to allow running arbitrary build artefacts
CMD ["/bin/bash"]
# Ignore VCS metadata .git .gitignore # Build and cache build/ CMakeFiles/ CMakeCache.txt cmake-build-*/ doc/ doc/html/ # OS / IDE junk *.log *.aux *.out *.o *.a *.so *.dll *.exe *.swp *.temp *.tmp README.*.md # Dependency caches node_modules/ .vscode/ # Archives *.tar.gz *.zip *.tar.xz *.tgz
# Ignore VCS metadata .git .gitignore # Build and cache build/ CMakeFiles/ CMakeCache.txt cmake-build-*/ doc/ doc/html/ # OS / IDE junk *.log *.aux *.out *.o *.a *.so *.dll *.exe *.swp *.temp *.tmp README.*.md # Dependency caches node_modules/ .vscode/ # Archives *.tar.gz *.zip *.tar.xz *.tgz
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Build stage: compile the multi-directory C++ project using CMake
FROM gcc:15 AS builder
WORKDIR /src
# Copy the repository into the image
COPY . .
# Install required build tools and OpenMP runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
build-essential \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# Configure and build the project
RUN cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Runtime stage: provide a slim image with the built artifacts
FROM debian:bookworm-slim AS runtime
WORKDIR /src
# Install OpenMP runtime library for the built binaries
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built artifacts from the builder stage
COPY --from=builder /src/build /src/build
# Default command: drop into a shell so users can run any built executable
CMD ["bash"]
# Docker ignore file to exclude large or unnecessary files from context .git build/ CMakeFiles/ cmake_install.cmake CMakeCache.txt Makefile *.o *.obj *.a *.so *.dll *.dylib *.pyc __pycache__/ doc/html/ doc/styles/ doc/assets/
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Docker ignore file to exclude large or unnecessary files from context .git build/ CMakeFiles/ cmake_install.cmake CMakeCache.txt Makefile *.o *.obj *.a *.so *.dll *.dylib *.pyc __pycache__/ doc/html/ doc/styles/ doc/assets/
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Build stage: compile the multi-directory C++ project using CMake
FROM gcc:15 AS builder
WORKDIR /src
# Copy the repository into the image
COPY . .
# Install required build tools and OpenMP runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
build-essential \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# Configure and build the project
RUN cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Runtime stage: provide a slim image with the built artifacts
FROM debian:bookworm AS runtime
WORKDIR /src
# Install OpenMP runtime library for the built binaries
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built artifacts from the builder stage
COPY --from=builder /src/build /src/build
# Default command: drop into a shell so users can run any built executable
CMD ["bash"]
FROM gcc:15.2.0 AS builder
WORKDIR /src
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
build-essential \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
COPY . .
# Configure and build
RUN cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build --parallel
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies (OpenMP runtime)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy built artifacts from builder (preserve structure; executables live under build subdirs)
COPY --from=builder /src/build /app/build
WORKDIR /app
# Provide an interactive shell as a simple entrypoint to inspect/run built binaries
CMD ["/bin/sh"]
# Ignore common VCS and build artifacts .git **/.git build **/build doc/html **/doc/html CMakeFiles CMakeCache.txt cmake_install.cmake Makefile *.log node_modules __pycache__
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
FROM gcc:15.2.0 AS builder
WORKDIR /src
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
cmake \
build-essential \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy source code
COPY . .
# Configure and build
RUN cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build --parallel \
&& cmake --install build --prefix /usr/local
# Runtime stage
FROM debian:bookworm-slim AS runtime
# Install runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
ENV PATH=/usr/local/bin:$PATH
WORKDIR /work
CMD ["/bin/bash"]
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
Image gcc:15.2.0 exists on Docker Hub.
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
# Ignore common VCS and build artifacts .git/ **/.git/ build/ **/build/ doc/html/ **/doc/html/ CMakeFiles/ CMakeCache.txt cmake_install.cmake Makefile *.log node_modules/ __pycache__/
ERROR: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock