update ci
This commit is contained in:
parent
b503fb7bb9
commit
a93f185969
3 changed files with 67 additions and 68 deletions
53
.github/workflows/docker-build-push.yml
vendored
Normal file
53
.github/workflows/docker-build-push.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
name: Docker (Build and Push)
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
|
||||||
|
# permissions are needed if pushing to ghcr.io
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_push:
|
||||||
|
name: Build and Push
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Get the repository's code
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# https://github.com/docker/setup-qemu-action
|
||||||
|
- uses: docker/setup-qemu-action@v3
|
||||||
|
# https://github.com/docker/setup-buildx-action
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
images: |
|
||||||
|
ghcr.io/muratovas/docker-network-graph
|
||||||
|
# Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
60
.github/workflows/docker.yml
vendored
60
.github/workflows/docker.yml
vendored
|
@ -1,60 +0,0 @@
|
||||||
name: Publish Docker image
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
jobs:
|
|
||||||
push_to_registry:
|
|
||||||
name: Build and push docker image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Docker meta
|
|
||||||
id: docker_meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/docker-network-graph,ghcr.io/${{ github.repository_owner }}/docker-network-graph
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
- name: Cache Docker layers
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: /tmp/.buildx-cache
|
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-buildx-
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64
|
|
||||||
push: True
|
|
||||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
22
README.md
22
README.md
|
@ -13,21 +13,23 @@ Changes:
|
||||||
![example graph](./example.png)
|
![example graph](./example.png)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
```bash
|
||||||
usage: docker-network-graph.py [-h] [-v] [-o OUT] [-u]
|
usage: docker-network-graph.py [-h] [-v] [-o OUT] [-u]
|
||||||
|
|
||||||
Visualize docker networks.
|
Visualize docker networks.
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help Show this help message and exit
|
-h, --help Show this help message and exit
|
||||||
-v, --verbose Verbose output
|
-v, --verbose Verbose output
|
||||||
-o OUT, --out OUT Write output to file [not supported by container]
|
-o OUT, --out OUT Write output to file [not supported by container]
|
||||||
-u, --url Generate link for GraphvizOnline
|
-u, --url Generate link for GraphvizOnline
|
||||||
|
```
|
||||||
|
|
||||||
## Running inside docker
|
## Running inside docker
|
||||||
If you want to generate a graph for a remote system you can also easily
|
If you want to generate a graph for a remote system you can also easily
|
||||||
run this script inside a pre-built docker container:
|
run this script inside a pre-built docker container:
|
||||||
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock e-dant/docker-network-graph -u
|
```bash
|
||||||
|
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock muratovas/docker-network-graph -u
|
||||||
|
```
|
||||||
|
|
||||||
For more advanced use cases you can append arguments to the `docker run`
|
For more advanced use cases you can append arguments to the `docker run`
|
||||||
command as if you were running it in a local shell.
|
command as if you were running it in a local shell.
|
||||||
|
@ -35,10 +37,12 @@ command as if you were running it in a local shell.
|
||||||
## Running local
|
## Running local
|
||||||
In most cases what you want to run are the following couple commands:
|
In most cases what you want to run are the following couple commands:
|
||||||
|
|
||||||
git clone https://github.com/e-dant/docker-network-graph.git
|
```bash
|
||||||
cd docker-network-graph
|
git clone https://github.com/muratovas/docker-network-graph.git
|
||||||
pipenv install
|
cd docker-network-graph
|
||||||
pipenv run python docker-network-graph.py -o output.svg
|
pipenv install
|
||||||
|
pipenv run python docker-network-graph.py -o output.svg
|
||||||
|
```
|
||||||
|
|
||||||
This will generate an .svg file containing the graph.
|
This will generate an .svg file containing the graph.
|
||||||
|
|
||||||
|
@ -58,5 +62,7 @@ using dummy containers in `test`.
|
||||||
You can deploy it using `docker-compose -f docker-compose.yml up -d`.
|
You can deploy it using `docker-compose -f docker-compose.yml up -d`.
|
||||||
|
|
||||||
## Credit
|
## Credit
|
||||||
|
|
||||||
[dot lang](https://www.graphviz.org/doc/info/lang.html)
|
[dot lang](https://www.graphviz.org/doc/info/lang.html)
|
||||||
|
|
||||||
[gvonline](https://dreampuf.github.io/GraphvizOnline/)
|
[gvonline](https://dreampuf.github.io/GraphvizOnline/)
|
||||||
|
|
Loading…
Reference in a new issue