Skip to content

Commit a0477bc

Browse files
oscar0ursellioscar
andauthored
Sync dev with main (#16)
* Update workflow (#15) * misc(run.py): [dev] Suricata rules management, save digger mode used, fix stop command. * refactor(webapp): [dev] Small changes to webapp backend code structure. * fix(webapp): [dev] Small fixed in code generation for raw flow data. * chore: [dev] Remove tracking of suricata.rules and small edit to run.py * fix(rules): Update CCIT.rules * Improve run.py features (#13) * feat(run.py): [dev] Preserve CTF config between docker downs * feat(run.py): [dev] Can remove database volume. * feat(run.py): [dev] Check if volume exists before trying to remove it. * refactor(run.py): [dev] Create function for prompts that require y/n ans --------- Co-authored-by: oscar <oscar@debian.oscar> * Add worflow to build and publish Docker images * Update docker-publish.yml --------- Co-authored-by: oscar <oscar@debian.oscar> * Update docker-publish.yml * Update docker-publish.yml * Update docker-publish.yml * Switch Docker publish to GitHub Container Registry Updated Docker publish workflow to use GitHub Container Registry instead of Docker Hub. Adjusted environment variables and steps accordingly. * Refactor Docker publish workflow to use lowercase repo * Refactor Docker image echo statements in workflow * Update compose fils to use GHCR for already built images. --------- Co-authored-by: oscar <oscar@debian.oscar>
1 parent 35a2be6 commit a0477bc

4 files changed

Lines changed: 34 additions & 15 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ on:
2020
workflow_dispatch:
2121

2222
env:
23-
REGISTRY: docker.io
24-
IMAGE_NAME: ${{ github.repository_owner }}
23+
REGISTRY: ghcr.io
2524

2625
jobs:
2726
build-and-push:
@@ -31,7 +30,7 @@ jobs:
3130
include:
3231
- dockerfile: ./suricata/Dockerfile
3332
image_name: digger-suricata
34-
context: .
33+
context: ./suricata
3534
- dockerfile: ./webapp/Dockerfile
3635
image_name: digger-webapp
3736
context: ./webapp
@@ -44,6 +43,7 @@ jobs:
4443

4544
permissions:
4645
contents: read
46+
packages: write
4747

4848
steps:
4949
- name: Checkout repository
@@ -52,12 +52,17 @@ jobs:
5252
- name: Set up Docker Buildx
5353
uses: docker/setup-buildx-action@v3
5454

55-
- name: Log in to Docker Hub
55+
- name: Log in to GitHub Container Registry
5656
uses: docker/login-action@v3
5757
with:
5858
registry: ${{ env.REGISTRY }}
59-
username: ${{ secrets.DOCKER_USERNAME }}
60-
password: ${{ secrets.DOCKER_PASSWORD }}
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Convert to lowercase
63+
id: lowercase
64+
run: |
65+
echo "repository=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
6166
6267
- name: Convert repository name to lowercase
6368
id: lowercase
@@ -67,7 +72,7 @@ jobs:
6772
id: meta
6873
uses: docker/metadata-action@v5
6974
with:
70-
images: ${{ env.REGISTRY }}/${{ steps.lowercase.outputs.image_name }}/${{ matrix.image_name }}
75+
images: ${{ env.REGISTRY }}/${{ steps.lowercase.outputs.repository }}/${{ matrix.image_name }}
7176
tags: |
7277
type=ref,event=branch
7378
type=semver,pattern={{version}}
@@ -80,27 +85,31 @@ jobs:
8085
with:
8186
context: ${{ matrix.context }}
8287
file: ${{ matrix.dockerfile }}
83-
push: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
88+
push: true
8489
tags: ${{ steps.meta.outputs.tags }}
8590
labels: ${{ steps.meta.outputs.labels }}
86-
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ steps.lowercase.outputs.image_name }}/${{ matrix.image_name }}:buildcache
87-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ steps.lowercase.outputs.image_name }}/${{ matrix.image_name }}:buildcache,mode=max
91+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ steps.lowercase.outputs.repository }}/${{ matrix.image_name }}:buildcache
92+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ steps.lowercase.outputs.repository }}/${{ matrix.image_name }}:buildcache,mode=max
8893

8994
summary:
9095
runs-on: ubuntu-latest
9196
needs: build-and-push
9297
if: always()
9398
steps:
99+
- name: Convert to lowercase
100+
id: lowercase
101+
run: |
102+
echo "repository=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
94103
- name: Create job summary
95104
run: |
96105
echo "## Docker Images Published" >> $GITHUB_STEP_SUMMARY
97106
echo "" >> $GITHUB_STEP_SUMMARY
98-
echo "The following images have been built and pushed:" >> $GITHUB_STEP_SUMMARY
107+
echo "The following images have been built and pushed to GitHub Container Registry:" >> $GITHUB_STEP_SUMMARY
99108
echo "" >> $GITHUB_STEP_SUMMARY
100-
echo "- \`docker.io/pwnzer0tt1/digger-suricata\`" >> $GITHUB_STEP_SUMMARY
101-
echo "- \`docker.io/pwnzer0tt1/digger-webapp\`" >> $GITHUB_STEP_SUMMARY
102-
echo "- \`docker.io/pwnzer0tt1/digger-grafana\`" >> $GITHUB_STEP_SUMMARY
103-
echo "- \`docker.io/pwnzer0tt1/digger-pcap-broker\`" >> $GITHUB_STEP_SUMMARY
109+
echo "- \`${{ env.REGISTRY }}/digger-suricata\`" >> $GITHUB_STEP_SUMMARY
110+
echo "- \`${{ env.REGISTRY }}/digger-webapp\`" >> $GITHUB_STEP_SUMMARY
111+
echo "- \`${{ env.REGISTRY }}/digger-grafana\`" >> $GITHUB_STEP_SUMMARY
112+
echo "- \`${{ env.REGISTRY }}/digger-pcap-broker\`" >> $GITHUB_STEP_SUMMARY
104113
echo "" >> $GITHUB_STEP_SUMMARY
105114
echo "**Tags applied:**" >> $GITHUB_STEP_SUMMARY
106115
echo "- Branch name (for push events)" >> $GITHUB_STEP_SUMMARY

docker-compose-a.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ name: digger
1010

1111
services:
1212
suricata:
13+
image: ghcr.io/pwnzer0tt1/digger-suricata:latest
1314
build: ./suricata
1415
volumes:
1516
- "./input_pcaps:/input_pcaps:rw"
@@ -23,6 +24,7 @@ services:
2324
- postgres
2425

2526
webapp:
27+
image: ghcr.io/pwnzer0tt1/digger-webapp:latest
2628
build: ./webapp
2729
restart: always
2830
volumes:
@@ -44,6 +46,7 @@ services:
4446
POSTGRES_HOST_AUTH_METHOD: trust
4547

4648
grafana:
49+
image: ghcr.io/pwnzer0tt1/digger-grafana:latest
4750
build: ./grafana
4851
restart: always
4952
ports:

docker-compose-b.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ name: digger
1010

1111
services:
1212
suricata:
13+
image: ghcr.io/pwnzer0tt1/digger-suricata
1314
build: ./suricata
1415
volumes:
1516
- "./input_pcaps:/input_pcaps:rw"
@@ -28,6 +29,7 @@ services:
2829
- postgres
2930

3031
webapp:
32+
image: ghcr.io/pwnzer0tt1/digger-webapp
3133
build: ./webapp
3234
restart: always
3335
volumes:
@@ -48,6 +50,7 @@ services:
4850
POSTGRES_HOST_AUTH_METHOD: trust
4951

5052
grafana:
53+
image: ghcr.io/pwnzer0tt1/digger-grafana
5154
build: ./grafana
5255
restart: always
5356
ports:

docker-compose-c.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ name: digger
1010

1111
services:
1212
suricata:
13+
image: ghcr.io/pwnzer0tt1/digger-suricata
1314
build: ./suricata
1415
volumes:
1516
- "./input_pcaps:/input_pcaps:ro"
@@ -28,6 +29,7 @@ services:
2829
- PCAP_OVER_IP=pcap-broker:4242
2930

3031
webapp:
32+
image: ghcr.io/pwnzer0tt1/digger-webapp
3133
build: ./webapp
3234
restart: always
3335
volumes:
@@ -39,6 +41,7 @@ services:
3941
- postgres
4042

4143
pcap-broker:
44+
image: ghcr.io/pwnzer0tt1/digger-pcap-broker
4245
build: ./pcap_broker
4346
restart: always
4447
volumes:
@@ -57,6 +60,7 @@ services:
5760
POSTGRES_HOST_AUTH_METHOD: trust
5861

5962
grafana:
63+
image: ghcr.io/pwnzer0tt1/digger-grafana
6064
build: ./grafana
6165
restart: always
6266
ports:

0 commit comments

Comments
 (0)