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

feat(docker): Move script to entrypoint #92

Closed

Conversation

titom73
Copy link

@titom73 titom73 commented Apr 6, 2023

Overview

Moving script to entrypoint make it easier to leverage script argument from CLI instead of always leveraging ENV variable.

docker run --rm --env-file=env-develop \
  ghcr.io/minitriga/netbox-device-type-library-import --vendors Arista,Juniper

ENV variable approach is unchanged and can still be used.

Changes:

  • Update Dockerfile for ENTRYPOINT
  • Update Dockerfile to explicitely set ENV names
  • Update documentation accordingly (README.md)
  • Add type to all code blocks in README.md

Overview

Moving script to entrypoint make it easier to leverage script argument
from CLI instead of always leveraging ENV variable.

```
docker run --rm --env-file=env-develop ghcr.io/minitriga/netbox-device-type-library-import --vendors Arista,Juniper
```

`ENV` variable approach is unchanged and can still be used.

Changes:

- Update Dockerfile for ENTRYPOINT
- Update Dockerfile to explicitely set ENV names
- Update documentation accordingly (README.md)
- Add type to all code blocks in README.md
@danner26
Copy link
Member

Running the script with no arguments would cause all items to be imported, I am not sure if that is desired behavior. I also have not looked into the use case for dockerizing this, could you provide some insight how you use this with docker?

@titom73
Copy link
Author

titom73 commented Apr 11, 2023

Today, current docker implementation does run an import for all vendors if nothing is specified

$ cat env-develop
NETBOX_URL=http://10.73.1.248:8000
NETBOX_TOKEN=hidden
REPO_URL=https://github.com/titom73/netbox-devicetype-library.git
REPO_BRANCH=homenetwork
IGNORE_SSL_ERRORS=False
#SLUGS=c9300-48u isr4431 isr4331

$ docker run --rm --env-file=env-develop ghcr.io/minitriga/netbox-device-type-library-import
Package Installed https://github.com/titom73/netbox-devicetype-library.git
No Vendors Specified, Gathering All Device-Types
106 Vendors Found

After adding VENDORS key in environment, both scripts have the same behavior:

$ cat env-develop
NETBOX_URL=http://10.73.1.248:8000
NETBOX_TOKEN=hidden
REPO_URL=https://github.com/titom73/netbox-devicetype-library.git
REPO_BRANCH=homenetwork
IGNORE_SSL_ERRORS=False
VENDORS=Arista

With current docker image

$ docker run --rm --env-file=env-develop ghcr.io/minitriga/netbox-device-type-library-import
Package Installed https://github.com/titom73/netbox-devicetype-library.git
Vendor Specified, Gathering All Matching Device-Types
1 Vendors Found
52 Device-Types Found

With new Dockerfile:

$ docker run --rm --env-file=env-develop ghcr.io/titom73/nb-device-importer:dev
Package Installed https://github.com/titom73/netbox-devicetype-library.git
1 Vendors Found
52 Device-Types Found

Idea of this change is to be able to use cli options in any situation: script invocation or docker execution.

@danner26
Copy link
Member

Looks like a good idea to me. So we have a bit more lifting to do, since the repo was moved from minitriga to netbox-community we need to setup the docker package and all of that good stuff. Please ping me if a few days go by and I havent reached back out about that yet

@titom73 titom73 closed this by deleting the head repository Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants