diff --git a/Dockerfile b/Dockerfile index 5f1c5ac..2b5b0dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,36 @@ -# use the base VNC image +# STAGE 1: Build CraftOS-PC +FROM alpine:latest as builder + +RUN apk add --no-cache git cmake g++ make mono-msbuild mono-dev zlib-dev + +WORKDIR /src + +# Clone the repository and get latest tag +RUN git clone https://github.com/MCJack123/craftos2.git . \ + && git fetch --tags \ + && LATEST_TAG=$(git tag | sort -V | tail -n 1) \ + && git checkout "$LATEST_TAG" \ + && git submodule update --init --recursive + +# Attempt to build CraftOS-PC using MSBuild +# Note: This assumes CraftOS-PC is buildable on Linux using mono-msbuild +RUN msbuild "CraftOS-PC 2.sln" /p:Configuration=Release + +# Assuming output binary ends up in a known location (adjust as needed) +# For example, `bin/Release/net462` or similar, and ROM is under `CraftOS-PC/ROM` +RUN mkdir /output && cp -r ROM /output/ROM \ + && find . -type f -name 'CraftOS-PC*' -executable -exec cp {} /output/ \; + +# STAGE 2: Final image with CraftOS-PC FROM git.merith.xyz/gns3/base-vnc:latest -## START setting your image here -# RUN apk add --no-cache firefox-esr - -## STOP setting up your image here -# DO NOT REMOVE AND DO NOT ADD AN "ENTRYPOINT" COMMAND +# Copy entrypoint COPY ./entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh \ No newline at end of file +RUN chmod +x /entrypoint.sh + +# Copy build output +COPY --from=builder /output /opt/craftos + +# Optional: Add to PATH or set working directory +ENV PATH="/opt/craftos:$PATH" +WORKDIR /opt/craftos diff --git a/entrypoint.sh b/entrypoint.sh index e4891f6..8d84fa9 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/bash -xterm \ No newline at end of file +/opt/craftos/craftos \ No newline at end of file