Skip to content

Commit 07431ed

Browse files
authored
Shrink the development environment container
Use a smaller container, based on Alpine (note: travis-ci has not reported success, but when checking the build, it is green as can be: https://travis-ci.org/github/xtofl/cpp11training/builds/703191129)
2 parents d61ae5f + 6b3b654 commit 07431ed

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

docker/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM ubuntu:18.04
1+
FROM alpine:3
22

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
3+
RUN apk update
4+
RUN apk add make cmake>=3.11 g++>=9
5+
RUN apk add vim git
6+
RUN apk add clang

docker/_typical_workflow.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
set -x
4+
projectdir=$(cd $(dirname $0)/.. && pwd)
5+
6+
# make a build folder
7+
cd $(mktemp -d -t cpp11training_build)
8+
9+
# make the project
10+
cmake $projectdir/src && make
11+
12+
# run the tests
13+
./cpp11training
14+

docker/build-container.bat

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

docker/build-container.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
cd $(cd $(dirname $0)/..; pwd)
4+
docker build --tag cpp11training docker
5+
docker/test_buildimage.sh

docker/test_buildimage.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# script to test the build container
4+
#
5+
# it runs the typical workflow in the build container
6+
# (cf. _typical_workflow.sh)
7+
8+
project_dir=$(cd $(dirname $0)/..; pwd)
9+
10+
docker build -t xtofl/cpp11training $project_dir/docker
11+
12+
docker run --volume $(pwd):$(pwd) --workdir $(pwd) --rm ${IMAGE:-"xtofl/cpp11training"} /bin/sh docker/_typical_workflow.sh
13+

0 commit comments

Comments
 (0)