Thehive: Include Dockerfile in root of project

Created on 5 Feb 2020  路  6Comments  路  Source: TheHive-Project/TheHive

Include Dockerfile in root of project

Request Type

Feature Request

Description

As part of the development and release cycle, please include the Dockerfile generated by docker.sbt in the root of the project so that the container can be built directly from the repo itself.

Note: This is a rehash of a previously closed issue which I believe is worth revisiting.

Most helpful comment

Thanks @ilyaglow

All 6 comments

Made a similar request in Cortex: https://github.com/TheHive-Project/Cortex/issues/247

Dockerfile generated by sbt won't let you build container directly from the repo itself. It just copies files that are already built into a docker image.

I put some effort a year ago to create one. Happily send a PR if TheHive Project's maintainers are willing to have it here though.

@ilyaglow I think you should do that 馃憤

@ilyaglow great job for your Dockerfile. You don't need to install sbt as TheHive comes with a wrapper (./sbt). You should also remove all java local cache (~/.m2, ~/.ivy2 and ~/.sbt). Send a PR and put dockerfile in package/docker folder, I will merge the PR. But keep in mind that official docker image will still be generated by sbt, not your file.

Thanks @ilyaglow

Awesome! Recently I've improved it a little more (and was going to send a PR but had not enough time), so the image could be built like this:

docker build -t thehive 'https://github.com/ilyaglow/TheHive.git#add-dockerfile' -f docker/thehive/Dockerfile

With your recent commit you can build TheHive repo like that too, but it clones the repo twice: first on the docker build and second on the git clone inside the Dockerfile, which is unnecessary since we obviously already have the repo on disk. So, the COPY approach will eliminate this and as a consequence speed up build time a little.

Also, it allows users to build container for any chosen branch that has this dockerfile without even using docker build args because it always copy current git context. As a downside, it doesn't allow us (or it won't be straightforward) to build an older version of TheHive repo.

Just something to probably consider.

Was this page helpful?
0 / 5 - 0 ratings