Skip to content

Commit 1c2cbbb

Browse files
committed
Optimized Dockerfile for layer cache and moved all the installations for cache not to rerun the same layer for every code change for Docker container.
1 parent f5aff55 commit 1c2cbbb

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

Dockerfile

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
FROM kalilinux/kali-rolling
2-
1+
FROM kalilinux/kali-rolling:latest
32
RUN apt-get update && \
4-
apt-get install -y git python3-pip figlet sudo;
5-
6-
#Install packages dependencies
7-
RUN true && \
8-
apt-get install -y boxes php curl xdotool wget;
3+
apt-get install -y git python3-pip figlet sudo && \
4+
apt-get install -y boxes php curl xdotool wget
95

106
WORKDIR /root/hackingtool
7+
COPY requirements.txt ./
8+
RUN pip3 install --no-cache-dir boxes flask lolcat requests -r requirements.txt
119
COPY . .
12-
13-
RUN true && \
14-
pip3 install boxes flask lolcat requests -r requirements.txt;
15-
16-
RUN true && \
17-
echo "/root/hackingtool/" > /home/hackingtoolpath.txt;
18-
10+
RUN true && echo "/root/hackingtool/" > /home/hackingtoolpath.txt;
1911
EXPOSE 1-65535
20-
21-
ENTRYPOINT ["python3", "/root/hackingtool/hackingtool.py"]
12+
ENTRYPOINT ["python3", "/root/hackingtool/hackingtool.py"]

README.md

+28-7
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,34 @@
240240

241241
## Use image with Docker
242242

243-
### Run in one click
244-
`docker run -it vgpastor/hackingtool`
245-
246-
### Build locally
247-
`docker-compose build`
248-
249-
`docker-compose run hackingtool`
243+
### Create Docker Image
244+
- Create the docker image
245+
246+
```bash
247+
docker buitl -t vgpastor/hackingtool .
248+
```
249+
250+
### Run as container
251+
252+
```bash
253+
docker-compose up -d
254+
```
255+
256+
### Interact with terminal
257+
258+
- Get into the container
259+
```bash
260+
docker exec -it hackingtool bash
261+
```
262+
**OUTPUT:**
263+
```bash
264+
Select Best Option :
265+
266+
[1] Kali Linux / Parrot-Os (apt)
267+
[2] Arch Linux (pacman)
268+
[0] Exit
269+
```
270+
Enter the options and continue.
250271

251272
- If need open other ports you can edit the docker-compose.yml file
252273
- Volumes are mounted in the container to persist data and can share files between the host and the container

docker-compose.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
version: "3.9"
22
services:
33
hackingtool:
4-
build: .
5-
stdin_open: true # docker run -i
6-
tty: true # docker run -t
4+
image: vgpastor/hackingtool
5+
container_name: hackingtool
6+
stdin_open: true
7+
tty: true
78
volumes:
89
- .:/root/hackingtool
910
ports:

0 commit comments

Comments
 (0)