Skip to content

Commit

Permalink
added build.sh script to run docker container and extract compiled bi…
Browse files Browse the repository at this point in the history
…nary
  • Loading branch information
dreadl0ck committed Jan 5, 2019
1 parent 3bd6d26 commit ecff680
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Binary file added dist/linux_amd64/netcap
Binary file not shown.
25 changes: 25 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# build image
docker build -t "netcap-linux" .

docker run netcap-linux

# docker image ls

# grab container ID
echo "[INFO] looking for linux container ID"
CONTAINER_ID=$(docker ps -a -f ancestor=netcap-linux -q)
if [[ $CONTAINER_ID == "" ]]; then
echo "[ERROR] no docker container found"
exit 1
fi

# create path in dist
mkdir -p ../dist/linux_amd64

# extract binary from container
docker cp $CONTAINER_ID:/go/nc-linux ../dist/linux_amd64/netcap

# remove container
docker rm $CONTAINER_ID

0 comments on commit ecff680

Please sign in to comment.