Skip to content

Commit 5a6740e

Browse files
committed
azure: build Docker images as part of the pipeline
The Docker images used for our continuous integration builds currently live in the libgit2/libgit2-docker repository. To make any changes in them, one has to make a PR there, get it reviewed, re-build the images and publish them to Docker Hub. This process is slow and tedious, making it harder than necessary to perform any updates to our Docker-based build pipeline. To fix this, we include all Dockerfiles used by Azure from the mentioned repository and inline them into our own repo. Instead of having to manually push them to the CI, it will now build the required containers on each pull request, allowing much greater flexibility.
1 parent 561a3a2 commit 5a6740e

File tree

7 files changed

+85
-14
lines changed

7 files changed

+85
-14
lines changed

azure-pipelines.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ jobs:
1313
steps:
1414
- template: azure-pipelines/docker.yml
1515
parameters:
16-
imageName: 'libgit2/trusty-amd64:latest'
16+
docker:
17+
image: trusty
18+
base: ubuntu:trusty
1719
environmentVariables: |
1820
CC=gcc
1921
CMAKE_GENERATOR=Unix Makefiles
@@ -26,7 +28,9 @@ jobs:
2628
steps:
2729
- template: azure-pipelines/docker.yml
2830
parameters:
29-
imageName: 'libgit2/trusty-amd64:latest'
31+
docker:
32+
image: trusty
33+
base: ubuntu:trusty
3034
environmentVariables: |
3135
CC=gcc
3236
CMAKE_GENERATOR=Unix Makefiles
@@ -39,7 +43,9 @@ jobs:
3943
steps:
4044
- template: azure-pipelines/docker.yml
4145
parameters:
42-
imageName: 'libgit2/trusty-amd64:latest'
46+
docker:
47+
image: trusty
48+
base: ubuntu:trusty
4349
environmentVariables: |
4450
CC=clang
4551
CMAKE_GENERATOR=Unix Makefiles
@@ -52,7 +58,9 @@ jobs:
5258
steps:
5359
- template: azure-pipelines/docker.yml
5460
parameters:
55-
imageName: 'libgit2/trusty-amd64:latest'
61+
docker:
62+
image: trusty
63+
base: ubuntu:trusty
5664
environmentVariables: |
5765
CC=clang
5866
CMAKE_GENERATOR=Unix Makefiles
@@ -136,6 +144,10 @@ jobs:
136144
pool:
137145
vmImage: 'Ubuntu 16.04'
138146
steps:
147+
- script: |
148+
cd $(Build.SourcesDirectory)/azure-pipelines/docker
149+
docker build -t libgit2/docurium --build-arg BASE=ubuntu:trusty -f docurium .
150+
displayName: 'Build Docker image'
139151
- script: |
140152
git config user.name 'Documentation Generation'
141153
git config user.email 'libgit2@users.noreply.github.com'

azure-pipelines/docker.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ steps:
44
- script: docker run --rm --privileged multiarch/qemu-user-static:register --reset
55
displayName: 'Register Docker QEMU'
66

7+
- script: |
8+
cd $(Build.SourcesDirectory)/azure-pipelines/docker
9+
docker build -t libgit2/${{parameters.docker.image}} --build-arg BASE=${{parameters.docker.base}} -f ${{parameters.docker.image}} .
10+
displayName: 'Build Docker image'
711
- task: docker@0
812
displayName: Build
913
inputs:
1014
action: 'Run an image'
11-
imageName: ${{ parameters.imageName }}
15+
imageName: libgit2/${{ parameters.docker.image }}
1216
volumes: |
1317
$(Build.SourcesDirectory):/src
1418
$(Build.BinariesDirectory):/build
@@ -20,7 +24,7 @@ steps:
2024
displayName: Test
2125
inputs:
2226
action: 'Run an image'
23-
imageName: ${{ parameters.imageName }}
27+
imageName: libgit2/${{ parameters.docker.image }}
2428
volumes: |
2529
$(Build.SourcesDirectory):/src
2630
$(Build.BinariesDirectory):/build

azure-pipelines/docker/bionic

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG BASE
2+
FROM $BASE
3+
ARG CACHEBUST=1
4+
RUN apt-get update
5+
RUN apt-get -y install pkgconf clang git cmake curl libssl-dev libcurl4 libcurl4-openssl-dev libssh2-1-dev libz-dev valgrind openssh-client openssh-server
6+
RUN if [ "$ARCH" != "armhf" -a "$ARCH" != "arm64" ]; then apt-get -y install openjdk-11-jre-headless; fi
7+
RUN mkdir /var/run/sshd

azure-pipelines/docker/docurium

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM debian:jessie-slim
2+
ARG CACHEBUST=1
3+
RUN apt-get update
4+
RUN apt install -y cmake pkg-config ruby ruby-dev llvm libclang-3.5-dev libssl-dev python-pygments
5+
ARG CACHEBUST=1
6+
RUN gem install docurium

azure-pipelines/docker/trusty

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ARG BASE
2+
FROM $BASE
3+
ARG CACHEBUST=1
4+
5+
RUN apt-get update
6+
RUN apt-get install -y curl apt-transport-https software-properties-common
7+
RUN curl -sSL "https://bintray.com/user/downloadSubjectPublicKey?username=bintray" | apt-key add -
8+
RUN echo "deb https://dl.bintray.com/libgit2/ci-dependencies trusty libgit2deps" >> /etc/apt/sources.list
9+
RUN add-apt-repository ppa:openjdk-r/ppa -y
10+
RUN apt-get update
11+
RUN apt-get -y install clang git cmake libssl-dev libcurl3 libcurl3-gnutls libcurl4-gnutls-dev libssh2-1-dev valgrind openssh-client openssh-server openjdk-8-jre libpcre3 libpcre3-dev
12+
13+
RUN git clone --branch mbedtls-2.6.1 https://github.com/ARMmbed/mbedtls.git /tmp/mbedtls
14+
RUN (cd /tmp/mbedtls && scripts/config.pl set MBEDTLS_MD4_C 1)
15+
RUN (cd /tmp/mbedtls && CFLAGS=-fPIC cmake -DENABLE_PROGRAMS=OFF -DENABLE_TESTING=OFF -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON .)
16+
RUN (cd /tmp/mbedtls && cmake --build .)
17+
RUN (cd /tmp/mbedtls && make install)
18+
RUN rm -rf /tmp/mbedtls
19+
20+
RUN mkdir /var/run/sshd

azure-pipelines/docker/xenial

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ARG BASE
2+
FROM $BASE
3+
ARG CACHEBUST=1
4+
RUN apt-get update
5+
RUN apt-get -y install pkgconf clang git cmake curl libssl-dev libcurl3 libcurl3-gnutls libcurl4-gnutls-dev valgrind openssh-client openssh-server openjdk-8-jre
6+
RUN mkdir /var/run/sshd

azure-pipelines/nightly.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ jobs:
99
steps:
1010
- template: docker.yml
1111
parameters:
12-
imageName: 'libgit2/trusty-amd64:latest'
12+
docker:
13+
image: trusty
14+
base: ubuntu:trusty
1315
environmentVariables: |
1416
CC=gcc
1517
CMAKE_GENERATOR=Unix Makefiles
@@ -23,7 +25,9 @@ jobs:
2325
steps:
2426
- template: docker.yml
2527
parameters:
26-
imageName: 'libgit2/trusty-amd64:latest'
28+
docker:
29+
image: trusty
30+
base: ubuntu:trusty
2731
environmentVariables: |
2832
CC=gcc
2933
CMAKE_GENERATOR=Unix Makefiles
@@ -37,7 +41,9 @@ jobs:
3741
steps:
3842
- template: docker.yml
3943
parameters:
40-
imageName: 'libgit2/trusty-amd64:latest'
44+
docker:
45+
image: trusty
46+
base: ubuntu:trusty
4147
environmentVariables: |
4248
CC=clang
4349
CMAKE_GENERATOR=Unix Makefiles
@@ -51,7 +57,9 @@ jobs:
5157
steps:
5258
- template: docker.yml
5359
parameters:
54-
imageName: 'libgit2/trusty-amd64:latest'
60+
docker:
61+
image: trusty
62+
base: ubuntu:trusty
5563
environmentVariables: |
5664
CC=clang
5765
CMAKE_GENERATOR=Unix Makefiles
@@ -144,7 +152,9 @@ jobs:
144152
- template: docker.yml
145153
parameters:
146154
qemu: 'true'
147-
imageName: 'libgit2/bionic-x86:latest'
155+
docker:
156+
image: bionic
157+
base: multiarch/ubuntu-core:x86-bionic
148158
environmentVariables: |
149159
CC=gcc
150160
CMAKE_GENERATOR=Unix Makefiles
@@ -159,7 +169,9 @@ jobs:
159169
- template: docker.yml
160170
parameters:
161171
qemu: 'true'
162-
imageName: 'libgit2/bionic-x86:latest'
172+
docker:
173+
image: bionic
174+
base: multiarch/ubuntu-core:x86-bionic
163175
environmentVariables: |
164176
CC=clang
165177
CMAKE_GENERATOR=Unix Makefiles
@@ -174,7 +186,9 @@ jobs:
174186
- template: docker.yml
175187
parameters:
176188
qemu: 'true'
177-
imageName: 'libgit2/bionic-arm32:latest'
189+
docker:
190+
image: bionic
191+
base: multiarch/ubuntu-core:armhf-bionic
178192
environmentVariables: |
179193
CC=gcc
180194
CMAKE_GENERATOR=Unix Makefiles
@@ -190,7 +204,9 @@ jobs:
190204
- template: docker.yml
191205
parameters:
192206
qemu: 'true'
193-
imageName: 'libgit2/bionic-arm64:latest'
207+
docker:
208+
image: bionic
209+
base: multiarch/ubuntu-core:arm64-bionic
194210
environmentVariables: |
195211
CC=gcc
196212
CMAKE_GENERATOR=Unix Makefiles

0 commit comments

Comments
 (0)