Commit Graph

56 Commits

Author SHA1 Message Date
Tobias Genannt a6584d2874
Merge pull request #274 from tobiasge/optimise-builds
Optimise builds
2020-05-15 13:57:43 +02:00
ibeljakov 1c65f7af10 Dockerfile: Fixed file permissions for media 2020-04-18 17:08:42 +03:00
Tobias Genannt 8e34f46bad Add checks to verifiy if a new build is needed
This checks if the source materials (python image, Netbox commit,
netbox-docker commit) have changed since the last build. This check is done
by comparing the digest and commit ids from the previous image with the
given tag to the current values taken from the Git and Docker repositories.

The checks are only performed for builds by the automated builds on Github.
2020-04-08 15:50:06 +02:00
Christian Mäder 355f9d4cf7 Prepare for Netbox 2.7 2020-01-20 08:39:26 +01:00
Christian Mäder 0a9991de96
Merge pull request #186 from netbox-community/non-root
Non root
2019-12-20 14:21:34 +01:00
Christian Mäder 8664e42233 Revert "Fix #179 'libc not found'"
This reverts commit feb810ab27.
2019-11-26 11:40:10 +01:00
Christian Mäder 7942e9edbe Remove the named user, change permissions to 'g+w' 2019-11-26 11:24:12 +01:00
Christian Mäder 01c4137dc9 Adds netbox user 2019-11-26 11:24:12 +01:00
Christian Mäder caaa68234c Adds more labels to the Dockerfile
It also updates the README and the bug_report template to reflect
the changes. Additionally, in the README some relevant shields from
shields.io are added.

The labels follow [label-schema.org][lsorg] and the [OpenContainer
image spec, section annotations][ocis], specifications.

[lsorg]: http://label-schema.org/rc1/
[ocis]: https://github.com/opencontainers/image-spec/blob/master/annotations.md
2019-11-17 17:13:29 +01:00
Tobias Genannt feb810ab27 Fix #179 'libc not found'
Gunicorn version 20 crashes in this docker image. So for now use a
version <20.
2019-11-11 08:53:11 +01:00
Tobias Genannt f9662a1e4b Optimize pip install command
As mentioned by @sdktr the "--install-option" is redundant. The added
"--no-warn-script-location" is used to silence warnings when installing
into a directory that is not on $PATH.
2019-10-31 10:11:33 +01:00
Tobias Genannt e3f632d77f Fixes #170 - "drf-yasg" installed into wrong dir
With the new multistage build the pip install command put some packages
in the wrong directory. This resuled in them not being copied into the
runtime images. This commit add the additional "--prefix" option to the
install command. After that all test run and we no longer get the error
"ModuleNotFoundError: No module named 'drf_yasg'".
2019-10-24 17:02:23 +02:00
Nguyễn Trọng Vĩnh eb0f704ebe Remove trailing space in Dockerfile 2019-10-23 11:46:26 +07:00
Christian Mäder 20109c3392 Checkout the repository with git
This changes the build process even further. Instead
f using `wget` to fetch the current code, `git` is used.
This allows for faster switching between branches,
because only the differences between them have to be
fetched from the server.

But the main advantage is that the build cache can
finally be used as designed by Docker. Repetitive
builds are very fast now. This is also true between
branches and tags, as long as the `requirements.txt`
file doesn't change.
2019-10-15 00:34:15 +02:00
Christian Mäder f3b9c34e3b externalize netbox download with wget 2019-10-15 00:34:15 +02:00
Christian Mäder d0ebb34432 Refactor to multistage builds
This commit introduces a huge change in the build process.

What changed:

- Dockerfile.ldap was integrated into Dockerfile as a seperate
  [build stage][multistage-build].
- All the build scripts were refactored according to this.
- The `docker-compose.yml` file was adjusted likewise.
- The main build script, `/build.sh`, now always builds all
  targets (formerly called variants).
- The minimal requirements for Docker and docker-compose
  have increased.
- The build on hub.docker.com must be adjusted.

This change should also fix #156 permanently.

[multistage-build]: https://docs.docker.com/develop/develop-images/multistage-build/
2019-10-15 00:34:15 +02:00
takumin 7f22d21d5d fix AttributeError for ruamel.yaml 2019-07-30 20:09:02 +09:00
Tobias Genannt 135d29e06f Update base image
This updates the base image to Alpine 3.10 with Python 3.7
2019-07-05 08:22:25 +02:00
Christian Mäder dc3db2d9fd %s/digitalocean/netbox-community/gi
Thank you Digitalocean for sponsoring Netbox!
And thank you for letting it grow up and move out ;)
2019-07-02 21:32:58 +02:00
Christian Mäder dfd30f5eae Explain caching strategy in Dockerfile comments 2019-06-12 17:53:35 +02:00
Robert Ellegate a086c2fc22
Changing REF_URL to use HEAD/TAG agnostic API
Per [dicsuccion](https://github.com/netbox-community/netbox-docker/pull/137#issuecomment-495667921) with @cimnine, changing the API endpoint to one that retains functionality of previous URL while supporting both HEADS and TAGS
2019-05-28 10:45:10 -04:00
Robert Ellegate e33a2d2c0a
Adding REF to GitHub repo HEAD for cache busting
After installing requirements, check if  HEAD has changed and bust cache for RUN instruction for wget  archive
2019-05-23 11:20:39 -04:00
Christian Mäder 821fb5f36e Caching of requirements.txt
After [a discussion][1] with rje6459 on the networktocode Slack
in the #netbox-docker channel we've come up with a small improvement
to those that regularly have to build netbox docker locally.

It fetches the "requirements.txt" from the desired branch before
downloading netbox itself.

[1]: https://networktocode.slack.com/archives/CD23LP8BC/p1558537080023200
2019-05-22 18:05:54 +02:00
Christian Mäder 6c3db3deff Update django to 2.2 2019-05-09 09:57:01 +02:00
Christian Mäder 582064f4cd
Loosen version pinning for Django
This change is in accordance with https://github.com/digitalocean/netbox/issues/2808
2019-02-22 13:52:37 +01:00
Tobias Genannt 2450a70ca8 Update Alpine
This updates to the newest stable version (Alpine 3.9)
2019-02-21 15:30:40 +01:00
Tobias Genannt ab72ba10c2 Update Alpine
This updates to the newest stable version (Alpine 3.8)
2018-09-14 09:43:09 +02:00
Christian Mäder 2b3f831749
Don't lock Django to explicit version
... but rather use the same definition that is currently used in
Netbox's `requirements.txt`.
2018-08-14 10:08:34 -07:00
Christian Mäder 013f81b791
♻️ Make netbox-worker it's own container
One container should ideally have one responsibility [1]. Therefore I
implemented the netbox-worker to start in it's own container. This is
possible, because netbox and the worker communicate via redis anyway.

They still use the same image underneath, just the "command" they
execute while starting different.

Or in other words: I see no reason to introduce supervisord, when we
already have docker-compose which can take care of running multiple
processes.

Also, here's another benefit: Now it's possible to view the logs of the
webhook worker independently of the other netbox logs (and vice-versa).

Other changes in this commit:
* I don't see a reason to put a password for Redis in the docker-compose
  setup, so I removed it.
* Slightly changed the nginx config, so that the nginx startup command
  becomes simpler and any error should be visible in the docker log.
* Some housekeeping in the `Dockerfile`.
* Added some troubleshooting advice regarding webhooks to the README.

I'd like to thank Brady (@bdlamprecht [2]) here who did the harder
work of figuring out what's even required to have webhooks working. [3]

[1] 
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#decouple-applications
[2] https://github.com/bdlamprecht
[3] https://github.com/ninech/netbox-docker/pull/90
2018-08-13 14:04:09 -07:00
Brady Lamprecht b88974ef9f Working implementation of webhooks using new 'redis' container 2018-08-10 17:55:09 -06:00
Tobias Genannt 5e5cc13a05 Update to Alpine 3.7
Because the tag "python:3.6-alpine" points to Alpine 3.4 which is now
end of life (as of 2018-05-01) the image now pulls the Alpine 3.7 python
image
2018-05-09 09:52:33 +02:00
Tobias Genannt b46bd58e0a
Move config to /etc/netbox/config (Fixes #54)
With this the configuration is moved to /etc/netbox/config and the
default reports directory is set to /etc/netbox/reports. This enables
the user to mount reports from a config map or persistent volume in
OpenShift.
2018-04-04 10:13:30 +02:00
Christian Mäder f56a79381b
Introduces a Netbox Docker project version 2018-04-04 09:44:58 +02:00
Brady Lamprecht 07b1b4675c
Adding in support for NAPALM 2018-03-08 09:38:43 +01:00
Tobias Genannt 2a1b6e42a8 Externalize gunicorn-config
This moves the gunicorn_config.py into /etc/netbox so that it can be
easily mapped through a Openshift config map
2018-03-07 14:57:56 +01:00
Tobias Genannt ef76e4e8ea Modifications for Openshift
With these modifications the netbox containers can run on Openshift.
The configuration files can be imported from a config map to the
'/etc/netbox' directory and will be loaded from there.
2018-02-22 17:22:04 +01:00
Christian Mäder 2d6388b489
🐞 Be More Explicit On Paths 2018-02-16 10:49:34 +01:00
Christian Mäder 43cb9f7e50
Include Initializers
Initializers are startup scripts for common tasks like creating custom
fields. These are problems many users of Netbox Docker potentially face
and are therefore worth sharing.
2018-02-16 10:25:51 +01:00
Christian Mäder fe05ca5c7c
❇️ Adds new options to the build script 2018-02-02 12:48:38 +01:00
nathbooth 2aa582f3ce
Added ttf-ubuntu-font-family
The present build does not include a font-family causing Graphviz to render text as blank squares, including the ttf  ubuntu font-family means text is rendered correctly
2017-12-01 09:27:30 +00:00
Christian Mäder 94746ac5de
🐞 The upstream repo remove the docker config
.. so I copied it over to this repo.
2017-10-13 10:10:43 +02:00
Christian Mäder 38a1c4c7f2
Removes workaround for Django Rest Framework 2017-10-12 15:36:19 +02:00
misazr 167f816b94 Add description for library 2017-10-10 11:14:16 +02:00
misazr 4576531634 Set right version of django rest framework 2017-10-10 09:56:10 +02:00
Christian Mäder d58930ab67
🐳 Adds the possibility to overwrite the CMD 2017-08-30 11:10:15 +02:00
Christian Mäder ab0c255040
🐳 Change to the actual workdir 2017-08-30 11:09:24 +02:00
Christian Mäder 822350d666
🔼 Introduces a more recent gunicorn 2017-08-30 11:08:21 +02:00
Christian Mäder 4ce4373eb0
🐳 By default, build `latest` from the `master` branch 2017-08-30 11:07:28 +02:00
Christian Mäder 552227cca4
Updates default Docker build branch to a stable version 2017-06-19 09:30:24 +02:00
Christian Mäder 1072d243a3
Fixes logging config that prevented gunicon launch 2017-06-19 09:24:35 +02:00