Skip to content

Commit 00d887f

Browse files
authored
Add a dockerfile for building/running the tests
Add dockerfile. At the same time, this fixes #21
2 parents fd25370 + 0065bb2 commit 00d887f

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Prerequisite: currently I have it up and running for Visual Studio 2017 Communit
2828

2929
Open the `cpp11training/cpp11training.sln` solution.
3030

31+
### Docker host
32+
33+
If you don't want to litter your system with tools you don't trust, but you _do_ trust Docker, you can
34+
build and run the docker container in [docker](docker). You may even be in luck and simply `docker pull xtofl/cpp11training`.
35+
36+
Then, clone the repository, and start a cpp11training container. Now you can follow the steps like in Linux.
37+
38+
(windows users may be happy to find a `run_container.bat` script to help)
3139

3240
## Exercising
3341

cpp11training/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.8.2)
1+
cmake_minimum_required(VERSION 3.8.0)
22
include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/SetupGoogletest.cmake")
33

44
set(CMAKE_CXX_STANDARD 17)

docker/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ubuntu:18.04
2+
3+
RUN apt update
4+
RUN apt install -y gcc-8 cmake
5+
RUN apt install -y vim git
6+
RUN apt install -y g++-8

docker/build-container.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build --tag cpp11training %~dp0

docker/run_container.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker run -it -v "%~dp0:/cpp11training" cpptraining /bin/bash

0 commit comments

Comments
 (0)