diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index a8e1ef8..176c179 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -6,41 +6,54 @@ on: release: types: [published] + workflow_dispatch: + inputs: + opencanary-branch: + description: "Branch of the opencanary repo to use" + default: 'master' + required: false + jobs: docker-build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - - - name: Set Image tag - run: | - if [[ "${{ github.ref_name }}" == "master" ]]; then - echo "TAG=latest" >> "$GITHUB_ENV" - else - echo "TAG=${{ github.ref_name }}" >> "$GITHUB_ENV" - fi - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + with: + ref: ${{ inputs.opencanary-branch }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to Github Container Registry + - name: Login to Dockerhub Registry uses: docker/login-action@v2 with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ github.token }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + thinkst/opencanary + tags: | + type=raw,value=latest + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v4 with: context: . file: Dockerfile.latest platforms: linux/amd64,linux/arm64 push: true - cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ env.TAG }} - cache-to: type=inline - tags: ghcr.io/${{ github.repository }}:${{ env.TAG }} + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta.outputs.tags }} diff --git a/Dockerfile.latest b/Dockerfile.latest index f4b5fe1..8a02997 100644 --- a/Dockerfile.latest +++ b/Dockerfile.latest @@ -2,10 +2,10 @@ FROM python:3.10-buster # Download cache lists and install minimal versions RUN apt-get update && apt-get -yq install --no-install-recommends \ - # Required linux dependencies - sudo && \ - # Remove cache lists and clean up anything not needed to minimize image size - apt-get autoremove -yq && apt-get clean && rm -rf /var/lib/apt/lists/* + # Required linux dependencies + sudo vim build-essential libssl-dev libffi-dev python-dev libpcap-dev && \ + # Remove cache lists and clean up anything not needed to minimize image size + apt-get autoremove -yq && apt-get clean && rm -rf /var/lib/apt/lists/* # Create and set the working directory WORKDIR /opencanary @@ -17,6 +17,7 @@ COPY bin /opencanary/bin # Install the required dependencies RUN pip install -r requirements.txt +RUN pip install scapy pcapy-ng # Copy in the latest version COPY opencanary ./opencanary diff --git a/Dockerfile.stable b/Dockerfile.stable index d57d0db..09fdae5 100644 --- a/Dockerfile.stable +++ b/Dockerfile.stable @@ -1,4 +1,4 @@ -FROM python:3.7-buster +FROM python:3.10-buster # Download cache lists and install minimal versions RUN apt-get update && apt-get -yq install --no-install-recommends \ @@ -9,7 +9,7 @@ RUN apt-get update && apt-get -yq install --no-install-recommends \ # Install required pip dependencies RUN pip install opencanary -RUN pip install scapy pcapy +RUN pip install scapy pcapy-ng # Set the default application we are running ENTRYPOINT [ "opencanaryd" ] diff --git a/README.md b/README.md index 919958c..d7b9950 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ $ sudo apt install samba # if you plan to use the smb module $ virtualenv env/ $ . env/bin/activate $ pip install opencanary -$ pip install scapy pcapy # optional +$ pip install scapy pcapy-ng # optional ``` ## Installation [OS X] @@ -88,7 +88,7 @@ $ env ARCHFLAGS="-arch arm64" LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" CFLA Now the installation can run as usual: ``` $ pip install opencanary -$ pip install scapy pcapy # optional +$ pip install scapy pcapy-ng # optional ``` ## Installation [GIT] diff --git a/docker-compose.yml b/docker-compose.yml index 3c8e6cd..a5631da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,7 @@ x-common: &common volumes: - ./data/.opencanary.conf:/root/.opencanary.conf image: "opencanary" + network_mode: "host" ports: # Comment/un-comment the port lines below to disable/enable the services you are using # FTP @@ -44,6 +45,7 @@ services: latest: # docker-compose up --build -d latest <<: *common container_name: opencanary_latest + image: thinkst/opencanary build: context: . dockerfile: Dockerfile.latest