1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00
ModernCppStarter/docker/Dockerfile
Michael Unknown 617257b7dc eof newline
2022-04-05 23:47:16 +02:00

38 lines
949 B
Docker

FROM ubuntu:20.04 as build
# install dev tools
ENV DEBIAN_FRONTEND=noninteractive
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
make \
cmake \
git \
gcc \
g++ \
; \
rm -rf /var/lib/apt/lists/*
# build in release mode
WORKDIR /build-all
COPY ./all ./all
COPY ./cmake ./cmake
COPY ./documentation ./documentation
COPY ./include ./include
COPY ./source ./source
COPY ./standalone ./standalone
COPY ./test ./test
COPY ./CMakeLists.txt .
RUN cmake -S all -B build -D CMAKE_BUILD_TYPE=Release
RUN cmake --build build
# make a test image - could also be done directly from/in the build image
FROM ubuntu:20.04 as test
WORKDIR /test
COPY --from=build /build-all/build/test/GreeterTests ./
CMD ["./GreeterTests"]
# make an image to deploy our 'app'
FROM ubuntu:20.04 as deploy
WORKDIR /app
COPY --from=build /build-all/build/standalone/Greeter ./
CMD ["./Greeter"]