Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions workflow for building and pushing Docker image #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github
DISCLAIMER.txt
LICENSE.txt
README.md
setup.py
48 changes: 48 additions & 0 deletions .github/workflows/docker-build-push.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ cmsmap/__pycache__/
.vscode
build
dist
.ropeproject
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]