Skip to content

Commit

Permalink
Refactor Dockerfile. (threat9#326)
Browse files Browse the repository at this point in the history
Add base layer with installing requirements to shorten build time.
Add .dockerignore to reduce amount of files to copy.
Remove unnecessary `run_docker.sh` script.
  • Loading branch information
fwkz authored Oct 8, 2017
1 parent 1d37006 commit b95b8d0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.idea/
.travis/

README.md
LICENSE
.travis.yml
*.pyc
*.log
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM python:2.7

WORKDIR /routersploit
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt

RUN git clone https://github.com/reverse-shell/routersploit/ .
RUN pip install -r requirements.txt
WORKDIR /routersploit
COPY . .

CMD ["python", "rsf.py"]
36 changes: 19 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Makefile that aggregates common chores before commit

.PHONY: all clean lint lint-modules test build update run help
.PHONY: build run test lint lint-modules clean prune help

MODULE=''
RSF_IMAGE=routersploit

all: lint test
build:
docker build -t $(RSF_IMAGE) .

clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
run:
docker run -it --rm $(RSF_IMAGE)

lint:
./run_linter.sh
Expand All @@ -20,21 +18,25 @@ lint-modules:
test: clean
./run_tests.sh $(MODULE)

build:
docker build -t routersploit:latest -f Dockerfile .

update:
./run_docker.sh git pull
clean:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

run:
./run_docker.sh
prune:
docker images -q -f dangling=true | xargs docker rmi
docker ps -q -f status=exited | xargs docker rm

help:
@echo " clean"
@echo " Remove python artifacts."
@echo " run"
@echo " Run Routersploit in docker container"
@echo " lint"
@echo " Check style with flake8."
@echo " lint-modules"
@echo " Check modules style with flake8."
@echo " test"
@echo " Run test suite"
@echo " clean"
@echo " Remove python artifacts."
@echo " prune"
@echo " Remove dangling docker images and exited containers."
7 changes: 0 additions & 7 deletions run_docker.sh

This file was deleted.

0 comments on commit b95b8d0

Please sign in to comment.