From 384edd789fd305d7313ff141ef54632ce3fb59d6 Mon Sep 17 00:00:00 2001 From: Hunter LaTourette Date: Mon, 24 Feb 2025 00:52:07 -0500 Subject: [PATCH 1/2] refactor (build): update Dockerfile --- Dockerfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3610cf..cea5a58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gcc:13.2 AS builder +FROM gcc:13.2 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/templateapp/build/ /usr/local/src/templateapp/build/ -WORKDIR /usr/local/src/templateapp/build +FROM scratch AS build-export +COPY --from=build /usr/local/src/templateapp/build/templateapp-Linux.deb / +WORKDIR / + +FROM ubuntu:latest AS test +COPY --from=build /usr/local/src/templateapp/build/tests/integration/templateapp.i.t /usr/local/bin +WORKDIR /usr/local/bin +ENTRYPOINT [ "/usr/local/bin/templateapp.i.t" ] + +FROM ubuntu:latest AS run +COPY --from=build /usr/local/src/templateapp/build/templateapp-Linux.deb /usr/local/bin +WORKDIR /usr/local/bin RUN dpkg -i templateapp-Linux.deb +ENTRYPOINT [ "/usr/bin/templateapp.sh" ] From 07ccc25598260430d1915a3f0239e7977f77a7e8 Mon Sep 17 00:00:00 2001 From: Hunter LaTourette Date: Mon, 24 Feb 2025 00:52:47 -0500 Subject: [PATCH 2/2] docs (readme): update README.md --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2998052..303bfc2 100644 --- a/README.md +++ b/README.md @@ -3,27 +3,24 @@ Template C/C++ application ## Build ``` -docker build [--target builder] -t templateappcpp . +docker build --target=build-export --output type=local,dest=./output . ``` ## Test ### Unit ``` -docker build [--target builder] -t templateappcpp . +docker build --target=build -t templateapp . ``` ### Integration ``` -docker build [--target tester] -t templateappcpp . -docker run -it --rm templateappcpp -> ./tests/integration/templateapp.i.t +docker build --target=test -t templateapp . +docker run -it --rm templateapp ``` ## Run ``` -docker run -it --rm templateappcpp -> cd /usr/bin -> ./templateapp.sh -> ./templateapp +docker build --target=run -t templateapp . +docker run -it --rm templateapp ```