forked from sqlmapproject/sqlmap
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI/CD workflow for Docker image builds
- Loading branch information
Lê Phương Hiếu
committed
Sep 11, 2024
1 parent
944e90d
commit b273023
Showing
7 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
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,106 @@ | ||
# Python generated files | ||
*.pyc | ||
__pycache__/ | ||
*.pyo | ||
*.pyd | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile.json | ||
.pyhistory | ||
.ipython/IPythonHistory.sqlite | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, it is recommended to omit it: | ||
# "This file can be locked to specific versions (including build numbers) of dependencies." | ||
# The recommendation is to commit this file if and only if Pipfile.lock is intended to be ignored. | ||
# .venv | ||
# env/ | ||
# venv/ | ||
# ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ |
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,5 @@ | ||
version: "1" | ||
rules: | ||
- base: master | ||
upstream: sqlmapproject:master | ||
mergeMethod: rebase |
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,89 @@ | ||
name: CI to Docker hub | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- 'upstream-master' | ||
pull_request: | ||
branches: | ||
- 'upstream-master' | ||
pull_request_review_comment: | ||
types: [created, edited] | ||
|
||
|
||
permissions: read-all | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'sqlmapproject/sqlmap' | ||
ref: master | ||
path: 'sqlmap' | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- name: Run shell | ||
run: |- | ||
ls -la; | ||
pwd | ||
cp Dockerfile ./sqlmap/ | ||
cp Dockerfile-alpine ./sqlmap/ | ||
cp Dockerfile-tor ./sqlmap/ | ||
cp entrypoint.sh ./sqlmap/ | ||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./sqlmap/ | ||
push: true | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sqlmap:latest | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
||
- name: Build and push | ||
id: docker_build_alpine | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./sqlmap/ | ||
file: ./Dockerfile-alpine | ||
push: true | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sqlmap:latest-alpine | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build_alpine.outputs.digest }} | ||
|
||
- name: Build and push | ||
id: docker_build_tor | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./sqlmap/ | ||
file: ./Dockerfile-tor | ||
push: true | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sqlmap:latest-tor | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build_tor.outputs.digest }} |
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,5 @@ | ||
FROM python:3 | ||
COPY . sqlmap-dev | ||
RUN apt update && apt install -y tor | ||
ENTRYPOINT ["python","sqlmap-dev/sqlmap.py"] | ||
CMD ["-h"] |
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,5 @@ | ||
FROM python:3-alpine | ||
COPY . sqlmap-dev | ||
RUN apk update && apk add tor | ||
ENTRYPOINT ["python3","sqlmap-dev/sqlmap.py"] | ||
CMD ["-h"] |
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,13 @@ | ||
FROM python:3 | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
COPY . /sqlmap-dev | ||
RUN apt clean; apt update; apt install -y tor systemd; \ | ||
# sed -i 's/#SocksPort.*/SocksPort 0.0.0.0:9050/g' /etc/tor/torrc; \ | ||
sed -i 's/#CookieAuthentication 1/CookieAuthentication 0/g' /etc/tor/torrc; \ | ||
sed -i 's/#CookieAuthFileGroupReadable 1/CookieAuthFileGroupReadable 0/g' /etc/tor/torrc; \ | ||
sed -i 's/#RunAsDaemon 1/RunAsDaemon 1/g' /etc/tor/torrc; \ | ||
/etc/init.d/tor restart | ||
|
||
WORKDIR /sqlmap-dev | ||
ENTRYPOINT ["bash", "/sqlmap-dev/entrypoint.sh"] | ||
CMD ["-h"] |
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,5 @@ | ||
#!/bin/env bash | ||
|
||
/etc/init.d/tor start | ||
|
||
python ./sqlmap.py $@ |