Skip to content

Commit

Permalink
add proper version to docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
lwimmer committed Feb 22, 2019
1 parent cc997df commit 8f4dc9d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
!autobuild.sh
!configure.ac
!Makefile.am
!src/**
!.git/**
!src/*.c
!src/*.h
!src/Makefile.am
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#####
FROM alpine AS build-env
RUN apk add --no-cache util-linux-dev gcc autoconf automake make openssl-dev json-c-dev musl-dev git
RUN apk add --no-cache util-linux-dev gcc autoconf automake make openssl-dev json-c-dev musl-dev

ADD . /work
WORKDIR /work

RUN ./autobuild.sh
ARG GIT_VERSION
RUN GIT_VERSION=${GIT_VERSION:-unknown} ./autobuild.sh

#####
FROM alpine
ARG GIT_VERSION
LABEL version=${GIT_VERSION:-unknown}
RUN apk add --no-cache libuuid json-c
COPY --from=build-env /work/src/rmbt /bin/rmbt
ENTRYPOINT ["/bin/rmbt"]
4 changes: 2 additions & 2 deletions autobuild.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
[ -e configure ] || autoreconf -i
[ -e Makefile ] || ( ./configure && make )
[ -e src/rmbt ] || make
[ -e Makefile ] || ./configure
make ${GIT_VERSION:+GIT_VERSION="$GIT_VERSION"}
3 changes: 3 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

docker build --build-arg "GIT_VERSION=$(git describe --abbrev=9 --dirty --always --tags --long 2> /dev/null)" -t rmbt .

0 comments on commit 8f4dc9d

Please sign in to comment.