First, and foremost, we'll need a Dockerfile. Let's use yet another CMake input file for this:
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Dockerfile.in
${PROJECT_BINARY_DIR}/Dockerfile @ONLY)
Note that we're using PROJECT_BINARY_DIRÂ to not overwrite any Dockerfiles created by other projects in the source tree if our project is part of a bigger one.
Our Dockerfile.in file will look as follows:
FROM ubuntu:latest
ADD Customer-@PROJECT_VERSION@-Linux.deb .
RUN apt-get update && \
apt-get -y --no-install-recommends install ./Customer-@PROJECT_VERSION@-Linux.deb && \
apt-get autoremove -y && \
apt-get clean && \
rm -r /var/lib/apt/lists/* Customer-@PROJECT_VERSION@-Linux.deb
ENTRYPOINT ["/usr/bin/customer"]
EXPOSE 8080
First, we specify that we'll take the latest Ubuntu image, install our DEB package on it along with its dependencies, and then tidy...