Dockerfile43 lines · 1038 chars # Build from source using a two-stage Docker build for tinyraycaster
# Stage 1: builder with dev tools to compile the project
FROM debian:oldstable-slim AS builder
ENV DEBIAN_FRONTEND=noninteractive
# Install build dependencies (CMake + SDL2 and common dev tools)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
libsdl2-dev \
netpbm \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Copy source and build
COPY . .
RUN mkdir -p build && cd build && cmake .. && make -j$(nproc)
# Stage 2: runtime image
FROM debian:oldstable-slim
ENV DEBIAN_FRONTEND=noninteractive
# Install runtime dependencies (SDL2 runtime, etc.)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libsdl2-2.0-0 \
netpbm \
file \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from the builder
COPY --from=builder /src/build/tinyraycaster /tinyraycaster
WORKDIR /
# Run the application (requires a display server for SDL)
CMD ["/tinyraycaster"]