Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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" ]
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```