From ab81c131d86cb961103f4419457b6a2975560088 Mon Sep 17 00:00:00 2001 From: Hunter LaTourette Date: Mon, 24 Feb 2025 01:10:56 -0500 Subject: [PATCH 1/3] refactor (build): update Dockerfile --- Dockerfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1d6829c..3c638ac 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,17 @@ 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" ] + +# to remove ? (keep for testing install) +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 From 42afbb01af9df3cba51e37e53404256d20e80168 Mon Sep 17 00:00:00 2001 From: Hunter LaTourette Date: Mon, 24 Feb 2025 01:11:09 -0500 Subject: [PATCH 2/3] docs (readme): update README.md --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 ``` From 2258464bfb5d1a9b3ef01f7c9ab8aec66542ec07 Mon Sep 17 00:00:00 2001 From: Hunter LaTourette Date: Mon, 24 Feb 2025 01:12:02 -0500 Subject: [PATCH 3/3] refactor (build): cleanup comment --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3c638ac..6c83337 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ COPY --from=build /usr/local/src/templatelib/build/tests/integration/templatelib WORKDIR /usr/local/bin ENTRYPOINT [ "/usr/local/bin/templatelib.i.t" ] -# to remove ? (keep for testing install) FROM ubuntu:latest AS run COPY --from=build /usr/local/src/templatelib/build/templatelib-Linux.deb /usr/local/bin WORKDIR /usr/local/bin