-
Notifications
You must be signed in to change notification settings - Fork 654
Adding a Dockerfile and making it easy to use it for dev #2745
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
Conversation
|
Please sign your commits following these rules: $ git clone -b "wk8/make_in_container" [email protected]:wk8/swarmkit.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -fAmending updates the existing PR. You DO NOT need to open a new one. |
aebcec0 to
66c2690
Compare
66c2690 to
3f8b3e8
Compare
3f8b3e8 to
eb68c26
Compare
Codecov Report
@@ Coverage Diff @@
## master #2745 +/- ##
==========================================
+ Coverage 61.7% 61.73% +0.02%
==========================================
Files 134 134
Lines 21890 21888 -2
==========================================
+ Hits 13507 13512 +5
+ Misses 6931 6913 -18
- Partials 1452 1463 +11 |
eb68c26 to
dfd256c
Compare
dfd256c to
05c7881
Compare
| @go test -parallel 8 ${RACE} -tags "${DOCKER_BUILDTAGS}" $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}) | ||
|
|
||
| .PHONY: integration-tests | ||
| integration-tests: ## run integration tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed from integration as that's the name of a directory, so when running with the containerized Makefile, make wouldn't see that as a phony target and wouldn't do anything...
05c7881 to
4388fa9
Compare
4388fa9 to
1d390c3
Compare
|
BTW the commit message doesn't need to follow the same format as the PR description or to be quite as long :) You can just put down a brief summary @wk8 |
dperny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
several nits, but none of them are blockers. you may decline to fix any of these things if you want to. just let me know.
Makefile
Outdated
|
|
||
| # stop here. do we want to run everything inside of a container, or do we want | ||
| # to run it directly on the host? if the user has set ANY non-empty value for | ||
| # the variable DOCKER_SWARMKIT_USE_CONTAINER, then we do all of the making inside of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit: would you mind wrapping to 80 columns? we don't consistently follow that style and i don't think we always should, but in cases like comments where there's no ugliness caused by doing so, it makes things a bit cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| @ if [ ! $$(docker images -q ${IMAGE_NAME}) ]; then $(MAKE) image; fi | ||
|
|
||
| # internal target, starts the sync if needed | ||
| # uses https://github.com/EugenMayer/docker-sync/blob/47363ee31b71810a60b05822b9c4bd2176951ce8/tasks/sync/sync.thor#L193-L196 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for example, i wouldn't expect this line to be wrapped to 80 columns, obviously)
| # which is not great, but that's all they expose so far to do this... | ||
| .PHONY: ensure_sync_started | ||
| ensure_sync_started: | ||
| @ kill -0 $$(cat .docker-sync/daemon.pid) 2&> /dev/null || docker-sync start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment explaining in a nutshell what this does? something along the lines of:
# checks if the daemon pid in the .docker-sync directory maps
# to the present daemon. if so, then...
...and so-on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| @go get -u github.com/gordonklaus/ineffassign | ||
| @go get -u github.com/client9/misspell/cmd/misspell | ||
| @go get -u github.com/lk4d4/vndr | ||
| @go get -u github.com/stevvooe/protobuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it may be handy, if we're going to use docker-sync, to include installation in the makefile, either here or in the other Makefile. Not necessarily as part of the setup target, if you don't think that's appropriate.
this is not a blocker, and if you decline to make this change, i'm unopposed to merging as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run make setup in the Dockerfile, so it's already baked into the image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does docker-sync not have a client-side component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh. Misunderstood you. It sure does. It comes as a gem. The idea here is that people who want to use it need to install it beforehand though. I don't want to go down the rabbithole of rvm and chruby and what not...
Credit goes to dperny (moby#2687) **- What I did** Adds a Dockerfile for the swarmkit project, to easily get off the ground. Modifies the Makefile to make intelligent use of Docker. Also made small clean up changes to the Makefile. **- How I did it** Modifies the Makefile to have two paths: containerized.mk, which builds the docker image and forwards any make targets to a container, and direct.mk, which encompasses the old Makefile's workflow. By default, nothing will run inside a container. Set the environment variable `DOCKER_SWARMKIT_USE_CONTAINER` to use dockerized making. Also leverages docker-sync for synchronizing code to the container if the `DOCKER_SWARMKIT_USE_DOCKER_SYNC` env variable is set; comes in handy on Macs, for example. **- How to test it** Set `DOCKER_SWARMKIT_USE_CONTAINER` and verify that your favorite make targets all work! Signed-off-by: Jean Rouge <[email protected]>
1d390c3 to
f8c048c
Compare
Credit goes to dperny (#2687)
- What I did
Adds a Dockerfile for the swarmkit project, to easily get off the ground. Modifies the Makefile to make intelligent use of Docker.
Also made small clean up changes to the Makefile.
- How I did it
Modifies the Makefile to have two paths: containerized.mk, which builds the docker image and forwards any make targets to a container, and direct.mk, which encompasses the old Makefile's workflow.
By default, nothing will run inside a container. Set the environment variable
DOCKER_SWARMKIT_USE_CONTAINERto use dockerized making.Also leverages docker-sync for synchronizing code to the container if the
DOCKER_SWARMKIT_USE_DOCKER_SYNCenv variable is set; comes in handy on Macs, for example.- How to test it
Set
DOCKER_SWARMKIT_USE_CONTAINERand verify that your favorite make targets all work!- Description for the changelog
Adding a Dockerfile and making it easy to use it for dev