Skip to content
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- export TAG=$(echo $TRAVIS_BRANCH | sed 's/\//-/g')
- echo -en "travis_fold:start:Docker_Build\r"
- docker build -t $REPO:$TAG --build-arg="BUILD_DATE=$(date --rfc-3339=seconds)" --build-arg=VERSION=$TRAVIS_TAG --build-arg=COMMIT_ID=$TRAVIS_COMMIT --build-arg=BRANCH=$TRAVIS_BRANCH --build-arg=REPOSITORY_URL="https://github.com/secureCodeBox/scanner-infrastructure-nmap" .
- docker build -t $REPO:$TAG-privileged --build-arg=BASE_TAG=$REPO:$TAG --build-arg="BUILD_DATE=$(date --rfc-3339=seconds)" --build-arg=VERSION=$TRAVIS_TAG --build-arg=COMMIT_ID=$TRAVIS_COMMIT --build-arg=BRANCH=$TRAVIS_BRANCH --build-arg=REPOSITORY_URL="https://github.com/secureCodeBox/scanner-infrastructure-nmap" .
- echo -en "travis_fold:end:Docker_Build\r"
deploy:
- provider: script
Expand Down
10 changes: 10 additions & 0 deletions .travis/deployDockerHub.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash


# WARNING!!!!!
# THIS script differs from the other deployToDockerHub Scripts in the other repos!
# This is to support the two build versions "default" and "privileged"

echo "Docker Login"
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
echo "Pushing to Dockerhub"
Expand All @@ -9,16 +14,21 @@ then
echo "Develop Build: Pushing develop tag"

echo $(docker tag $REPO:$TAG $REPO:develop)
echo $(docker tag $REPO:$TAG-privileged $REPO:develop-privileged)
echo $(docker tag $REPO:$TAG $REPO:develop-$TRAVIS_BUILD_NUMBER)

echo $(docker push $REPO:develop)
echo $(docker push $REPO:develop-privileged)
echo $(docker push $REPO:develop-$TRAVIS_BUILD_NUMBER)
elif [ "$TRAVIS_BRANCH" = "$TRAVIS_TAG" ]
then
echo "Tagged Release: Pushing versioned docker image."
echo $(docker tag $REPO:$TAG $REPO:$TRAVIS_TAG)
echo $(docker tag $REPO:$TAG-privileged $REPO:$TRAVIS_TAG-privileged)
echo $(docker tag $REPO:$TAG $REPO:latest)

echo $(docker push $REPO:$TRAVIS_TAG)
echo $(docker push $REPO:$TRAVIS_TAG-privileged)
echo $(docker push $REPO:latest)
else
echo "Feature Branch: Pushing only branch Tag"
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ USER nmap_user

EXPOSE 8080

ENV NMAP_UNPRIVILEGED=true

ARG COMMIT_ID=unkown
ARG REPOSITORY_URL=unkown
ARG BRANCH=unkown
Expand Down
12 changes: 12 additions & 0 deletions Dockfile.privileged
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG BASE_TAG=latest
FROM securecodebox/nmap:${BASE_TAG}

USER root

RUN apk --no-cache add libcap \
&& setcap 'cap_net_raw,cap_net_admin,cap_net_bind_service+eip' /usr/bin/nmap \
&& apk --no-cache del libcap

ENV NMAP_PRIVILEGED=true

USER nmap_user