Created
September 16, 2019 14:36
-
-
Save dlee35/82bec14b81c1a51ff9415f9749c17faa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FLEETDIR="$PWD/fleet" | |
WORKDIR="$PWD/fleetbuild" | |
FLEETGIT="kolide" | |
FLEETVER="HH1.1.0" | |
APKPACKS="git make yarn nodejs npm make g++ dep" | |
CONTAINERNAME="soshybridhunter_fleet_dev" | |
if [ ! -d $PWD/fleet ]; then | |
git clone https://github.com/$FLEETGIT/fleet | |
else | |
echo "A fleet directory already exists in the current working directory" | |
echo "Please comment this 'if' statement if you would prefer to use the local one" | |
exit 1 | |
fi | |
docker inspect go-fleet >/dev/null | |
if [ $(echo $?) == 0 ]; then | |
docker stop go-fleet | |
echo "Waiting on go-fleet container to stop" | |
sleep 5 | |
fi | |
docker pull golang:alpine | |
docker run -d --rm --name go-fleet -v $FLEETDIR:/go/src/github.com/kolide/fleet golang:alpine /bin/ash -c 'sleep 3599' | |
docker exec go-fleet /bin/ash -c "apk add --no-cache $APKPACKS" | |
docker exec go-fleet /bin/ash -c "cd /go/src/github.com/kolide/fleet; make deps && make generate && make" | |
mkdir -p $WORKDIR && cd $WORKDIR | |
cp $FLEETDIR/build/fleet . | |
cp $FLEETDIR/build/fleetctl . | |
wget -O startfleet.sh https://raw.githubusercontent.com/TOoSmOotH/securityonion-docker-hh/master/so-fleet/startfleet.sh | |
cat << EOF > Dockerfile | |
FROM soshybridhunter/so-fleet:$FLEETVER | |
COPY fleet /usr/bin/fleet | |
COPY fleetctl /usr/bin/fleetctl | |
COPY startfleet.sh /startfleet.sh | |
RUN chmod +x /startfleet.sh | |
ENTRYPOINT ["/startfleet.sh"] | |
EOF | |
docker build -t soshybridhunter/so-fleet:DEV . | |
docker save soshybridhunter/so-fleet:DEV -o $CONTAINERNAME | |
echo "Exported dev container is located at $WORKDIR/$CONTAINERNAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment