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

Include Dockerfile in root of project #1222

Closed
milesflo opened this issue Feb 5, 2020 · 6 comments
Closed

Include Dockerfile in root of project #1222

milesflo opened this issue Feb 5, 2020 · 6 comments
Assignees
Milestone

Comments

@milesflo
Copy link

milesflo commented Feb 5, 2020

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.

@milesflo
Copy link
Author

milesflo commented Feb 5, 2020

Made a similar request in Cortex: TheHive-Project/Cortex#247

@ilyaglow
Copy link

ilyaglow commented Feb 6, 2020

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.

@milesflo
Copy link
Author

milesflo commented Feb 6, 2020

@ilyaglow I think you should do that 👍

@To-om
Copy link
Contributor

To-om commented Mar 30, 2020

@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.

@To-om To-om self-assigned this Mar 30, 2020
@To-om To-om added this to the 3.4.1 milestone Apr 8, 2020
To-om added a commit that referenced this issue Apr 9, 2020
@To-om
Copy link
Contributor

To-om commented Apr 9, 2020

Thanks @ilyaglow

@To-om To-om closed this as completed Apr 9, 2020
@ilyaglow
Copy link

ilyaglow commented Apr 9, 2020

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.

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

No branches or pull requests

3 participants