FROM alpine:3.19 AS deps

WORKDIR /usr

RUN apk add gcc g++ cmake make acl

FROM alpine:3.19 AS build

WORKDIR /hikbuild

COPY --from=deps /usr /usr
COPY --from=deps /lib /lib
COPY . /hikbuild

RUN cmake . -D Arch=${TARGETARCH} -D CMAKE_BUILD_TYPE=RELEASE && make

FROM alpine:3.19 AS export

WORKDIR /home
COPY --from=build /hikbuild/build /home

#docker buildx build --platform linux/amd64,linux/arm64 --output type=local,dest=/hikbuild/ .