diff --git a/Dockerfile b/Dockerfile index 2b5b0dc..4943084 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,49 @@ -# STAGE 1: Build CraftOS-PC -FROM alpine:latest as builder +# Stage 1: Build CraftOS-PC with musl using Alpine +FROM alpine:latest AS builder -RUN apk add --no-cache git cmake g++ make mono-msbuild mono-dev zlib-dev +# Install build tools +RUN apk add --no-cache \ + git \ + autoconf \ + automake \ + libtool \ + make \ + g++ \ + sdl2-dev \ + zlib-dev \ + mesa-dev \ + libx11-dev \ + libxrandr-dev \ + libxext-dev \ + libxinerama-dev \ + libxcursor-dev \ + openssl-dev \ + poco-dev \ + harfbuzz-dev -WORKDIR /src +WORKDIR /build -# Clone the repository and get latest tag +# Clone and checkout 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 +# Run build process via Autotools +RUN ./configure \ + && cd craftos2-luajit && make -j$(nproc) \ + && make -C src -j$(nproc) -# 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 +# Stage 2: Alpine runtime container FROM git.merith.xyz/gns3/base-vnc:latest -# Copy entrypoint COPY ./entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -# Copy build output -COPY --from=builder /output /opt/craftos +# Copy binary + ROM +COPY --from=builder /build /opt/craftos-build -# Optional: Add to PATH or set working directory -ENV PATH="/opt/craftos:$PATH" WORKDIR /opt/craftos +ENV PATH="/opt/craftos:$PATH"