New packaging system.
This commit is contained in:
parent
4c060a78cc
commit
dabd9e2208
4 changed files with 88 additions and 26 deletions
55
.goreleaser.yml
Normal file
55
.goreleaser.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
project_name: traefik
|
||||||
|
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go generate
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- binary: traefik
|
||||||
|
|
||||||
|
main: ./cmd/traefik/traefik.go
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X github.com/containous/traefik/version.Version={{.Version}} -X github.com/containous/traefik/version.Codename={{.Env.CODENAME}} -X github.com/containous/traefik/version.BuildDate={{.Date}}
|
||||||
|
|
||||||
|
goos:
|
||||||
|
- linux
|
||||||
|
- darwin
|
||||||
|
- windows
|
||||||
|
- freebsd
|
||||||
|
- openbsd
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- 386
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
- ppc64le
|
||||||
|
goarm:
|
||||||
|
- 7
|
||||||
|
- 6
|
||||||
|
- 5
|
||||||
|
ignore:
|
||||||
|
- goos: darwin
|
||||||
|
goarch: 386
|
||||||
|
- goos: openbsd
|
||||||
|
goarch: arm
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: arm
|
||||||
|
|
||||||
|
changelog:
|
||||||
|
skip: true
|
||||||
|
|
||||||
|
archive:
|
||||||
|
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm
|
||||||
|
}}v{{ .Arm }}{{ end }}'
|
||||||
|
format: tar.gz
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
format: zip
|
||||||
|
files:
|
||||||
|
- LICENSE.md
|
||||||
|
- CHANGELOG.md
|
||||||
|
|
||||||
|
release:
|
||||||
|
disable: true
|
|
@ -12,7 +12,6 @@ env:
|
||||||
- REPO: $TRAVIS_REPO_SLUG
|
- REPO: $TRAVIS_REPO_SLUG
|
||||||
- VERSION: $TRAVIS_TAG
|
- VERSION: $TRAVIS_TAG
|
||||||
- CODENAME: maroilles
|
- CODENAME: maroilles
|
||||||
- N_MAKE_JOBS: 2
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- echo "Skipping tests... (Tests are executed on SemaphoreCI)"
|
- echo "Skipping tests... (Tests are executed on SemaphoreCI)"
|
||||||
|
@ -27,12 +26,12 @@ before_deploy:
|
||||||
docker version;
|
docker version;
|
||||||
make image;
|
make image;
|
||||||
if [ "$TRAVIS_TAG" ]; then
|
if [ "$TRAVIS_TAG" ]; then
|
||||||
make -j${N_MAKE_JOBS} crossbinary-parallel;
|
make release-packages;
|
||||||
tar cfz dist/traefik-${VERSION}.src.tar.gz --exclude-vcs --exclude dist .;
|
|
||||||
fi;
|
fi;
|
||||||
curl -sfL https://raw.githubusercontent.com/containous/structor/master/godownloader.sh | bash -s -- -b "${GOPATH}/bin" v1.4.0
|
curl -sfL https://raw.githubusercontent.com/containous/structor/master/godownloader.sh | bash -s -- -b "${GOPATH}/bin" v1.6.0
|
||||||
structor -o containous -r traefik --dockerfile-url="https://raw.githubusercontent.com/containous/traefik/v1.7/docs.Dockerfile" --menu.js-url="https://raw.githubusercontent.com/containous/structor/master/traefik-menu.js.gotmpl" --rqts-url="https://raw.githubusercontent.com/containous/structor/master/requirements-override.txt" --exp-branch=master --debug;
|
structor -o containous -r traefik --dockerfile-url="https://raw.githubusercontent.com/containous/traefik/v1.7/docs.Dockerfile" --menu.js-url="https://raw.githubusercontent.com/containous/structor/master/traefik-menu.js.gotmpl" --rqts-url="https://raw.githubusercontent.com/containous/structor/master/requirements-override.txt" --exp-branch=master --debug;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
- provider: releases
|
- provider: releases
|
||||||
api_key: ${GITHUB_TOKEN}
|
api_key: ${GITHUB_TOKEN}
|
||||||
|
|
46
Makefile
46
Makefile
|
@ -1,4 +1,4 @@
|
||||||
.PHONY: all docs docs-serve
|
.PHONY: all docs docs-serve clear-static
|
||||||
|
|
||||||
TRAEFIK_ENVS := \
|
TRAEFIK_ENVS := \
|
||||||
-e OS_ARCH_ARG \
|
-e OS_ARCH_ARG \
|
||||||
|
@ -13,6 +13,11 @@ TRAEFIK_ENVS := \
|
||||||
|
|
||||||
SRCS = $(shell git ls-files '*.go' | grep -v '^vendor/')
|
SRCS = $(shell git ls-files '*.go' | grep -v '^vendor/')
|
||||||
|
|
||||||
|
TAG_NAME := $(shell git tag -l --contains HEAD)
|
||||||
|
SHA := $(shell git rev-parse HEAD)
|
||||||
|
VERSION_GIT := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
|
||||||
|
VERSION := $(if $(VERSION),$(VERSION),$(VERSION_GIT))
|
||||||
|
|
||||||
BIND_DIR := "dist"
|
BIND_DIR := "dist"
|
||||||
TRAEFIK_MOUNT := -v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/containous/traefik/$(BIND_DIR)"
|
TRAEFIK_MOUNT := -v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/containous/traefik/$(BIND_DIR)"
|
||||||
|
|
||||||
|
@ -37,13 +42,6 @@ all: generate-webui build ## validate all checks, build linux binary, run all te
|
||||||
binary: generate-webui build ## build the linux binary
|
binary: generate-webui build ## build the linux binary
|
||||||
$(DOCKER_RUN_TRAEFIK) ./script/make.sh generate binary
|
$(DOCKER_RUN_TRAEFIK) ./script/make.sh generate binary
|
||||||
|
|
||||||
crossbinary: generate-webui build ## cross build the non-linux binaries
|
|
||||||
$(DOCKER_RUN_TRAEFIK) ./script/make.sh generate crossbinary
|
|
||||||
|
|
||||||
crossbinary-parallel:
|
|
||||||
$(MAKE) generate-webui
|
|
||||||
$(MAKE) build crossbinary-default crossbinary-others
|
|
||||||
|
|
||||||
crossbinary-default: generate-webui build
|
crossbinary-default: generate-webui build
|
||||||
$(DOCKER_RUN_TRAEFIK_NOTTY) ./script/make.sh generate crossbinary-default
|
$(DOCKER_RUN_TRAEFIK_NOTTY) ./script/make.sh generate crossbinary-default
|
||||||
|
|
||||||
|
@ -51,13 +49,6 @@ crossbinary-default-parallel:
|
||||||
$(MAKE) generate-webui
|
$(MAKE) generate-webui
|
||||||
$(MAKE) build crossbinary-default
|
$(MAKE) build crossbinary-default
|
||||||
|
|
||||||
crossbinary-others: generate-webui build
|
|
||||||
$(DOCKER_RUN_TRAEFIK_NOTTY) ./script/make.sh generate crossbinary-others
|
|
||||||
|
|
||||||
crossbinary-others-parallel:
|
|
||||||
$(MAKE) generate-webui
|
|
||||||
$(MAKE) build crossbinary-others
|
|
||||||
|
|
||||||
test: build ## run the unit and integration tests
|
test: build ## run the unit and integration tests
|
||||||
$(DOCKER_RUN_TRAEFIK) ./script/make.sh generate test-unit binary test-integration
|
$(DOCKER_RUN_TRAEFIK) ./script/make.sh generate test-unit binary test-integration
|
||||||
|
|
||||||
|
@ -74,9 +65,6 @@ validate: build ## validate code, vendor and autogen
|
||||||
build: dist
|
build: dist
|
||||||
docker build $(DOCKER_BUILD_ARGS) -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile .
|
docker build $(DOCKER_BUILD_ARGS) -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile .
|
||||||
|
|
||||||
build-webui:
|
|
||||||
docker build -t traefik-webui -f webui/Dockerfile webui
|
|
||||||
|
|
||||||
build-no-cache: dist
|
build-no-cache: dist
|
||||||
docker build --no-cache -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile .
|
docker build --no-cache -t "$(TRAEFIK_DEV_IMAGE)" -f build.Dockerfile .
|
||||||
|
|
||||||
|
@ -95,9 +83,6 @@ docs:
|
||||||
docs-serve:
|
docs-serve:
|
||||||
make -C ./docs docs-serve
|
make -C ./docs docs-serve
|
||||||
|
|
||||||
clear-static:
|
|
||||||
rm -rf static
|
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
mkdir dist
|
mkdir dist
|
||||||
|
|
||||||
|
@ -106,10 +91,17 @@ run-dev:
|
||||||
go build ./cmd/traefik
|
go build ./cmd/traefik
|
||||||
./traefik
|
./traefik
|
||||||
|
|
||||||
|
clear-static:
|
||||||
|
rm -rf static
|
||||||
|
|
||||||
|
build-webui:
|
||||||
|
docker build -t traefik-webui -f webui/Dockerfile webui
|
||||||
|
|
||||||
generate-webui: build-webui
|
generate-webui: build-webui
|
||||||
if [ ! -d "static" ]; then \
|
if [ ! -d "static" ]; then \
|
||||||
mkdir -p static; \
|
mkdir -p static; \
|
||||||
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui npm run build; \
|
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui npm run build; \
|
||||||
|
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui chown -R $(shell id -u):$(shell id -g) ../static; \
|
||||||
echo 'For more informations show `webui/readme.md`' > $$PWD/static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md; \
|
echo 'For more informations show `webui/readme.md`' > $$PWD/static/DONT-EDIT-FILES-IN-THIS-DIRECTORY.md; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -134,3 +126,15 @@ dep-prune:
|
||||||
|
|
||||||
help: ## this help
|
help: ## this help
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
|
release-packages: generate-webui build
|
||||||
|
rm -rf dist
|
||||||
|
$(DOCKER_RUN_TRAEFIK_NOTTY) goreleaser release --skip-publish
|
||||||
|
$(DOCKER_RUN_TRAEFIK_NOTTY) tar cfz dist/traefik-${VERSION}.src.tar.gz \
|
||||||
|
--exclude-vcs \
|
||||||
|
--exclude .idea \
|
||||||
|
--exclude .travis \
|
||||||
|
--exclude .semaphoreci \
|
||||||
|
--exclude .github \
|
||||||
|
--exclude dist .
|
||||||
|
$(DOCKER_RUN_TRAEFIK_NOTTY) chown -R $(shell id -u):$(shell id -g) dist/
|
||||||
|
|
|
@ -4,9 +4,13 @@ RUN apk --update upgrade \
|
||||||
&& apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar \
|
&& apk --no-cache --no-progress add git mercurial bash gcc musl-dev curl tar \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# Download golangci-lint and misspell binary to bin folder in $GOPATH
|
||||||
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0 \
|
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0 \
|
||||||
&& go get github.com/client9/misspell/cmd/misspell
|
&& go get github.com/client9/misspell/cmd/misspell
|
||||||
|
|
||||||
|
# Download goreleaser binary to bin folder in $GOPATH
|
||||||
|
RUN curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
|
||||||
|
|
||||||
# Which docker version to test on
|
# Which docker version to test on
|
||||||
ARG DOCKER_VERSION=17.03.2
|
ARG DOCKER_VERSION=17.03.2
|
||||||
ARG DEP_VERSION=0.5.0
|
ARG DEP_VERSION=0.5.0
|
||||||
|
|
Loading…
Reference in a new issue