first stab at docker image build process

This commit is contained in:
Hans-Christoph Steiner 2018-01-08 21:54:08 +01:00
parent c62e2042b7
commit 70e480390b
3 changed files with 65 additions and 0 deletions

36
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,36 @@
image: docker:git
services:
- docker:dind
stages:
- build
- test
- release
variables:
TEST_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:$CI_BUILD_REF_NAME
RELEASE_IMAGE: registry.gitlab.com/$CI_PROJECT_NAMESPACE/${CI_PROJECT_NAME}:latest
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
build:
stage: build
script:
- docker build -t $TEST_IMAGE .
- docker push $TEST_IMAGE
test:
stage: test
script:
- docker run $TEST_IMAGE /test
release:
stage: release
script:
- docker pull $TEST_IMAGE
- docker tag $TEST_IMAGE $RELEASE_IMAGE
- docker push $RELEASE_IMAGE
only:
- master
- tags

26
Dockerfile Normal file
View File

@ -0,0 +1,26 @@
from debian:sid-slim
MAINTAINER hans@eds.org
ENV LANG=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive
# install the minimum needed for a standard git-buildpackage build
# that includes pristine-tar. This also does not install
# documentation to keep the image small.
RUN printf "path-exclude=/usr/share/locale/*\npath-exclude=/usr/share/man/*\npath-exclude=/usr/share/doc/*\npath-include=/usr/share/doc/*/copyright\n" >/etc/dpkg/dpkg.cfg.d/01_nodoc \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade \
&& apt-get install -y --no-install-recommends \
build-essential \
dpkg-dev \
fakeroot \
git \
git-buildpackage \
pristine-tar \
&& apt-get -y autoremove --purge \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY test /

3
test Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
gbp --version