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

Refactor toolchain #1

Merged
merged 2 commits into from Sep 16, 2015
Merged

Conversation

vdemeester
Copy link
Contributor

This mainly change the Dockerfile and the Makefile and its targets to use docker for building. 🐧
This also updates the circleci.yml file to make the continuous integration to work with it.

The list of the current targets :

  • validate (validate-gofmt) : validates the projects files ; for now just checking on gofmt but could be used with other tooling (go vet, golint, …) β€” probably following PRs to come πŸ˜‰.
  • binary : build traefik using gox and but the result in dist (just like now, but using volumes).
  • test (test-unit, test-integration) : run tests (there is none for now but will be 😝).
  • image : make the final image that will be deployed on the docker hub (with just the binary in it).

This looks like :

Ξ» make validate binary test image
mkdir dist
docker build -t "traefik-dev:refactor-builds" -f build.Dockerfile .
Sending build context to Docker daemon 1.779 MB
Step 0 : FROM golang:1.5
# […]
Step 10 : COPY . /go/src/github.com/emilevauge/traefik
 ---> d8be632485b3
Removing intermediate container 8a241c6ac3d4
Successfully built d8be632485b3
docker run --rm -it -e OS_ARCH_ARG -e OS_PLATFORM_ARG -e TESTFLAGS -v "/home/vincent/src/github/vdemeester/traefik/dist:/go/src/github.com/emilevauge/traefik/dist" "traefik-dev:refactor-builds" ./script/make.sh validate-gofmt
---> Making bundle: validate-gofmt (in .)
Congratulations!  All Go source files are properly formatted.

docker run --rm -it -e OS_ARCH_ARG -e OS_PLATFORM_ARG -e TESTFLAGS -v "/home/vincent/src/github/vdemeester/traefik/dist:/go/src/github.com/emilevauge/traefik/dist" "traefik-dev:refactor-builds" ./script/make.sh generate binary
---> Making bundle: generate (in .)

---> Making bundle: binary (in .)
Number of parallel builds: 4

-->   windows/amd64: github.com/emilevauge/traefik
-->      darwin/386: github.com/emilevauge/traefik
-->       linux/386: github.com/emilevauge/traefik
-->    darwin/amd64: github.com/emilevauge/traefik
# […]
docker run --rm -it -e OS_ARCH_ARG -e OS_PLATFORM_ARG -e TESTFLAGS -v "/home/vincent/src/github/vdemeester/traefik/dist:/go/src/github.com/emilevauge/traefik/dist" "traefik-dev:refactor-builds" ./script/make.sh generate test-unit test-integration
---> Making bundle: generate (in .)

---> Making bundle: test-unit (in .)
+ go test -cover -coverprofile=cover.out .
ok      github.com/emilevauge/traefik   0.011s  coverage: 4.9% of statements

Test success


---> Making bundle: test-integration (in .)

if ! [ -a dist/traefik_linux-386 ] ; \
then \
        docker run --rm -it -e OS_ARCH_ARG -e OS_PLATFORM_ARG -e TESTFLAGS -v "/home/vincent/src/github/vdemeester/traefik/dist:/go/src/github.com/emilevauge/traefik/dist" "traefik-dev:refactor-builds" ./script/make.sh generate binary; \
fi;
docker build -t "emilevauge/traefik" .
Sending build context to Docker daemon 86.24 MB
Step 0 : FROM scratch
 ---> 
Step 1 : COPY dist/traefik_linux-386 /traefik
 ---> c653160cabdc
Removing intermediate container 122a59b85994
Step 2 : ENTRYPOINT /traefik
 ---> Running in dead98626bcd
 ---> 08695486f567
Removing intermediate container dead98626bcd
Successfully built 08695486f567

The way the build.Dockerfile is done for now is almost completely arbitrary (grouping the go get like that), but it's related to the following question (that could be handled in this PR too) :
What about using some tools to vendor dependencies ? (like godep or the experimental vendor thingy in go 1.5) β€” this would ease a bit the dev on traefik, with or without the use of the Makefile and docker 😝.

🐸

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
- Add a Makefile with common targets (binary, test, validate, ..)
- Use docker to build it (isolated)

And update circleci to work with the new Makefile..

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@emilevauge emilevauge merged commit 0ea8058 into traefik:master Sep 16, 2015
@vdemeester vdemeester deleted the refactor-builds branch September 16, 2015 13:39
@mikejihbe mikejihbe mentioned this pull request Dec 9, 2015
while1eq1 pushed a commit to while1eq1/traefik that referenced this pull request Oct 9, 2017
Update from upstream repo containous/traefik
nemosupremo added a commit to nemosupremo/traefik that referenced this pull request Dec 6, 2017
@ldez ldez mentioned this pull request Jan 11, 2018
apollo13 pushed a commit to apollo13/traefik that referenced this pull request Jan 22, 2021
Properly validate consul root CA.
apollo13 pushed a commit to apollo13/traefik that referenced this pull request Jan 22, 2021
use TLS to communicate with Consul Connect services
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