# # Build stage # FROM alpine:3.21 AS rr-builder ARG RR_VERSION # Install Essential Utilities RUN apk update RUN apk add bash git curl build-base unzip libc++-dev libc-dev lld cmake ninja make # Install dependencies RUN apk add curl-dev sdl2-dev zlib-dev libpng-dev libogg-dev libvorbis-dev libvpx-dev RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main libyuv libyuv-dev # Clone the repo RUN mkdir /buildfiles WORKDIR /buildfiles/ RUN git clone https://github.com/KartKrewDev/RingRacers.git # Build the code WORKDIR /buildfiles/RingRacers COPY --chown=ringracers:ringracers build.sh . RUN chmod +x build.sh RUN ./build.sh # # Server stage # FROM alpine:3.21 AS rr-server ARG RR_VERSION # Install runtime dependencies RUN apk add bash curl sdl2 zlib libpng libogg libvorbis libvpx RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main libyuv # Create a 'ringracers' group and user RUN addgroup -S ringracers && adduser -S ringracers -G ringracers USER ringracers # After building, copy build files to new container WORKDIR /home/ringracers/server COPY --chown=ringracers:ringracers --from=rr-builder /buildfiles/RingRacers/build/ninja-release/bin/ringracers_$RR_VERSION . COPY --chown=ringracers:ringracers ringserv-template.cfg . # Copy runner script WORKDIR /home/ringracers COPY --chown=ringracers:ringracers run_server.sh . RUN chmod +x run_server.sh # Set up environment variables ENV RINGRACERSWADDIR=/data/ringracers-data ENV RR_VERSION=${RR_VERSION} ENTRYPOINT [ "./run_server.sh" ]