add dockerize stage and Dockerfile

This commit is contained in:
Wolfgang Hottgenroth 2019-06-11 15:51:39 +00:00
parent fd51779aa2
commit cbe1cf8cf7
2 changed files with 36 additions and 0 deletions

View File

@ -1,5 +1,9 @@
stages:
- build
- dockerize
variables:
IMAGE_NAME: registry.gitlab.com/wolutator/mosquitto-with-auth
build:
stage: build
@ -15,6 +19,7 @@ build:
artifacts:
paths:
- opt/
- generated-version.txt
script:
- apt update
- apt install -y gcc g++ libssl-dev uuid-dev xsltproc docbook docbook-xsl libmariadbclient-dev
@ -31,4 +36,23 @@ build:
- make
- cp auth-plug.so $BUILD_DIR/opt/lib
- popd
- VERSION=`cat VERSION`
- REFCNT=`git rev-list --all --count`
- echo -n "$VERSION.$REFCNT.$CI_COMMIT_REF_NAME" > generated-version.txt
dockerize:
stage: dockerize
image: docker:stable
tags:
- hottis
- linux
- docker
dependencies:
- build
script:
- VERSION=`cat generated-version.txt`
- docker build --tag $IMAGE_NAME:latest --tag $IMAGE_NAME:$VERSION .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker push $IMAGE_NAME:latest
- docker push $IMAGE_NAME:$VERSION

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM debian:latest
LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
LABEL ImageName="registry.gitlab.com/wolutator/mosquitto-with-auth"
RUN \
apt update && \
apt install -y libmariadbclient && \
apt install -y openssl && \
mv opt /