-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added build.sh script to run docker container and extract compiled bi…
…nary
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
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 |