Skip to content

Commit

Permalink
trying to add docker/deb to generate debian package
Browse files Browse the repository at this point in the history
  • Loading branch information
yxqd committed Nov 9, 2015
1 parent ce6de22 commit 41c5ff5
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ add_subdirectory(bin)
# packaging
# CPACK
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_GENERATOR "RPM")
# set(CPACK_GENERATOR "DEB")
# set(CPACK_GENERATOR "RPM")
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME ${PKG_NAME})
set(CPACK_PACKAGE_SUMMARY ${SUMMARY})
set(CPACK_PACKAGE_LICENSE ${LICENSE})
Expand Down
1 change: 1 addition & 0 deletions docker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
set(DOCKER_ORG_NAME "danseins")

add_subdirectory(srpm)
add_subdirectory(deb)
30 changes: 30 additions & 0 deletions docker/deb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# docker

configure_file(prepare/Dockerfile prepare/Dockerfile)
configure_file(prepare/run.in prepare/run)

configure_file(build/Dockerfile.in build/Dockerfile)
configure_file(build/run.in build/run)

configure_file(test/Dockerfile.in test/Dockerfile)
configure_file(test/run.in test/run)

add_custom_target(
build-deb-deps
COMMAND bash run
WORKING_DIRECTORY prepare
)

# output under ..../build/DEB
add_custom_target(
build-deb
COMMAND bash run
WORKING_DIRECTORY build
)
add_dependencies(build-deb build-deb-deps)

add_custom_target(
test-deb
COMMAND bash run
WORKING_DIRECTORY test
)
13 changes: 13 additions & 0 deletions docker/deb/build/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ${DOCKER_ORG_NAME}/${PKG_NAME}-deb-deps

MAINTAINER "Jiao Lin <jiao.lin@gmail.com>"

RUN mkdir /work
WORKDIR /work
RUN git clone ${GITHUB_URL} src
RUN mkdir build
WORKDIR /work/build
RUN cmake ../src -DCMAKE_INSTALL_PREFIX=/opt/danse -DDEPLOYMENT_PREFIX=/opt/danse
RUN make package
RUN mkdir DEB
RUN mv *.deb DEB/
5 changes: 5 additions & 0 deletions docker/deb/build/run.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

IMG=${DOCKER_ORG_NAME}/${PKG_NAME}-deb
docker build -t $IMG --no-cache .
docker run -v $PWD:/OUTPUT $IMG mv /work/build/DEB /OUTPUT
8 changes: 8 additions & 0 deletions docker/deb/prepare/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:14.04

MAINTAINER "Jiao Lin <jiao.lin@gmail.com>"

RUN apt-get update
RUN apt-get install -y git build-essential
RUN apt-get install -y cmake
RUN apt-get install -y python python-dev
3 changes: 3 additions & 0 deletions docker/deb/prepare/run.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker build -t ${DOCKER_ORG_NAME}/${PKG_NAME}-deb-deps .
5 changes: 5 additions & 0 deletions docker/deb/test/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ${DOCKER_ORG_NAME}/${PKG_NAME}-srpm-deps

MAINTAINER "Jiao Lin <jiao.lin@gmail.com>"

RUN dpkg -i ${GITHUB_URL}/releases/download/v${VERSION}/${PKG_NAME}-${VERSION}-${CPACK_PACKAGE_RELEASE}.x86_64.deb
5 changes: 5 additions & 0 deletions docker/deb/test/run.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

IMG_NAME=${DOCKER_ORG_NAME}/${PKG_NAME}-srpm-test
docker build -t $IMG_NAME --no-cache . \
&& docker run -t $IMG_NAME find /opt/danse

0 comments on commit 41c5ff5

Please sign in to comment.