diff --git a/Dockerfile b/Dockerfile index 1d6829c..6c83337 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gcc:12.3 AS builder +FROM gcc:12.3 AS build RUN apt-get update && apt-get install -y \ catch2 \ cmake && \ @@ -11,7 +11,16 @@ RUN make build && \ make test && \ make package -FROM ubuntu:latest AS tester -COPY --from=builder /usr/local/src/templatelib/build/ /usr/local/src/templatelib/build/ -WORKDIR /usr/local/src/templatelib/build +FROM scratch AS build-export +COPY --from=build /usr/local/src/templatelib/build/templatelib-Linux.deb / +WORKDIR / + +FROM ubuntu:latest AS test +COPY --from=build /usr/local/src/templatelib/build/tests/integration/templatelib.i.t /usr/local/bin +WORKDIR /usr/local/bin +ENTRYPOINT [ "/usr/local/bin/templatelib.i.t" ] + +FROM ubuntu:latest AS run +COPY --from=build /usr/local/src/templatelib/build/templatelib-Linux.deb /usr/local/bin +WORKDIR /usr/local/bin RUN dpkg -i templatelib-Linux.deb diff --git a/README.md b/README.md index ed70c41..0100981 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,18 @@ Template C/C++ library ## Build ``` -docker build [--target builder] -t templatelibcpp . +docker build --target=build-export --output type=local,dest=./output . ``` ## Test ### Unit ``` -docker build [--target builder] -t templatelibcpp . +docker build --target build -t templatelib . ``` ### Integration ``` -docker build [--target tester] -t templatelibcpp . -docker run -it --rm templatelibcpp -> ./tests/integration/templatelib.i.t +docker build --target test -t templatelib . +docker run -it --rm templatelib ```