Skip to content

Commit

Permalink
chore: Add CI/CD workflow for Docker image builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Lê Phương Hiếu committed May 26, 2024
1 parent 507c719 commit 23fc329
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: "1"
rules:
- base: master
upstream: sqlmapproject:master
mergeMethod: rebase
87 changes: 87 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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@v5
with:
context: ./sqlmap/
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sqlmap:latest

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

- name: Build and push
id: docker_build_alpine
uses: docker/build-push-action@v5
with:
context: ./sqlmap/
file: ./Dockerfile-alpine
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sqlmap:latest-alpine

- name: Image digest
run: echo ${{ steps.docker_build_alpine.outputs.digest }}

- name: Build and push
id: docker_build_tor
uses: docker/build-push-action@v5
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 }}
5 changes: 5 additions & 0 deletions Dockerfile
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"]
5 changes: 5 additions & 0 deletions Dockerfile-alpine
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"]
13 changes: 13 additions & 0 deletions Dockerfile-tor
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"]
5 changes: 5 additions & 0 deletions entrypoint.sh
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 $@

0 comments on commit 23fc329

Please sign in to comment.