diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..49c348d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.github +DISCLAIMER.txt +LICENSE.txt +README.md +setup.py diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml new file mode 100644 index 0000000..c2b4bad --- /dev/null +++ b/.github/workflows/docker-build-push.yaml @@ -0,0 +1,48 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - master + +permissions: + contents: read + packages: write + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/cmsmap + tags: | + latest + type=ref,event=branch + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index f4e8cd3..e2760b5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ cmsmap/__pycache__/ .vscode build dist +.ropeproject diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..95b423b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM python:3.12-slim + +RUN apt update && apt install -y \ + git \ + && rm -rf /var/lib/apt/lists/* + +RUN git clone https://gitlab.com/exploit-database/exploitdb.git /opt/exploitdb +RUN ln -sf /opt/exploitdb/searchsploit /usr/local/bin/searchsploit + +WORKDIR /cmsmap + +COPY . . + +RUN sed -i 's|edbtype = apt|edbtype = GIT|' /cmsmap/cmsmap/cmsmap.conf +RUN sed -i 's|edbpath = /usr/share/exploitdb/|edbpath = /opt/exploitdb/|' /cmsmap/cmsmap/cmsmap.conf + +RUN mkdir /cmsmap/cmsmap/tmp && \ + git clone https://github.com/wordpress/wordpress /cmsmap/cmsmap/tmp/wordpress && \ + git clone https://github.com/joomla/joomla-cms /cmsmap/cmsmap/tmp/joomla && \ + git clone https://github.com/drupal/drupal /cmsmap/cmsmap/tmp/drupal && \ + git clone https://github.com/moodle/moodle /cmsmap/cmsmap/tmp/moodle + + +ENTRYPOINT [ "python", "cmsmap.py" ]