Skip to content

Commit

Permalink
Added docker build script.
Browse files Browse the repository at this point in the history
./docker_build/build.sh
  • Loading branch information
sholeksandr committed May 27, 2019
1 parent ae931fd commit 69335e7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output/
22 changes: 22 additions & 0 deletions docker_build/build-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -e

# Install extra dependencies that were provided for the build (if any)
# Note: dpkg can fail due to dependencies, ignore errors, and use
# apt-get to install those afterwards
[[ -d /dependencies ]] && dpkg -i /dependencies/*.deb || apt-get -f install -y --no-install-recommends

# Make read-write copy of source code
mkdir -p /build
cp -a /source-ro /build/source
cd /build/source

# Install build dependencies
mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y --no-install-recommends"

# Build packages
debuild -b -uc -us

# Copy packages to output dir with user's permissions
chown -R $USER:$GROUP /build
cp -a /build/*.deb /output/

12 changes: 12 additions & 0 deletions docker_build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e

SCRIPT=`realpath $0`
PWD=`dirname $SCRIPT`
OUTPUT=${PWD}/../output/
if [ ! -d "$OUTPUT" ]; then
mkdir $OUTPUT
fi
docker build -t docker-deb-builder:stretsh -f ${PWD}/dockerfile_hw_mgmt ${PWD}/
docker run -it -v ${PWD}/../:/source-ro:ro -v ${OUTPUT}:/output -v ${PWD}/build-helper.sh:/build-helper.sh:ro -e USER=5616 -e GROUP=101 --rm docker-deb-builder:stretsh /build-helper.sh
cd ${OUTPUT}
echo $(pwd)/$(ls)
15 changes: 15 additions & 0 deletions docker_build/dockerfile_hw_mgmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM debian:stretch
MAINTAINER Oleksandr Shamray <[email protected]>
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
devscripts \
equivs \
fakeroot \
debhelper \
automake \
autotools-dev \
pkg-config \
ca-certificates \
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/*

0 comments on commit 69335e7

Please sign in to comment.