Skip to content

Instantly share code, notes, and snippets.

@elico
Created Mar 20, 2017
Embed
What would you like to do?
ipfire build docker testing
#!/usr/bin/env bash
CLEAN=1
DEBUG=0
if [ "$CLEAN" -eq "1" ]; then
echo "removing /build/ipfire-2.x-docker"
rm -rf /build/ipfire-2.x-docker
echo "Finished removing /build/ipfire-2.x-docker"
echo "extracting ipfire-2.x-docker.tar.xz"
tar xf /build/ipfire-2.x-docker.tar.xz -C /build/
echo "Finished extraction"
# (pv -n /build/ipfire-2.x-docker.tar.xz | tar xzf - -C /build/ ) 2>&1 | dialog --gauge "Extracting file..." 6 50
else
echo "the build directory was not erased"
fi
cd /build/ipfire-2.x-docker
if [ "$DEBUG" -eq "1" ];then
head -1 /build/ipfire-2.x-docker/make.sh |grep "\-x"
if [ "$?" -eq "0" ]; then
echo "execution mode already set"
else
sed -i -e 's@#!/bin/bash@#!/bin/bash -x@g' /build/ipfire-2.x-docker/make.sh
echo 'set +x' >> /build/ipfire-2.x-docker/make.sh
fi
fi
./make.sh --target=x86_64 gettoolchain
./make.sh --target=x86_64 downloadsrc
./make.sh --target=x86_64 build
FROM ubuntu:16.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y linux-headers-generic \
&& apt-get install -y build-essential git-core g++ realpath patch byacc make python-urlgrabber autoconf automake nano wget pv dialog
RUN mkdir /build && chmod +x /build
VOLUME /build
CMD ["/bin/bash"]
#!/usr/bin/env bash
set -e
docker build -t local/ipfire-2-dev .
docker run -i -t -v `pwd`:/build/ local/ipfire-2-dev /build/build.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment