From 9292600abea0aed63cfa2efe63955bc69f9e753e Mon Sep 17 00:00:00 2001 From: Xidot Date: Sat, 15 Jul 2023 14:21:31 +0300 Subject: [PATCH] add build from source script; gitignore and small README --- traefik/.gitignore | 1 + traefik/README.md | 11 +++++++++++ traefik/build.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 traefik/.gitignore create mode 100644 traefik/README.md create mode 100755 traefik/build.sh diff --git a/traefik/.gitignore b/traefik/.gitignore new file mode 100644 index 0000000..470f4bd --- /dev/null +++ b/traefik/.gitignore @@ -0,0 +1 @@ +traefik* diff --git a/traefik/README.md b/traefik/README.md new file mode 100644 index 0000000..14c2c14 --- /dev/null +++ b/traefik/README.md @@ -0,0 +1,11 @@ +# Build Script + +This build script downloads the latest version of traefik form the +corresponding github releases page. To modify the installation version change +the `version` variable in the `build.sh`. + +# Requirements + +*Not installed by the build script.* + +* golang: 1.20.6 diff --git a/traefik/build.sh b/traefik/build.sh new file mode 100755 index 0000000..ca78875 --- /dev/null +++ b/traefik/build.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +version=v2.10.3 +name=traefik +appname=${name}-${version} +tarball=${appname}.src.tar.gz + +echo "Cleaning artefacts ..." +rm -rf ${tarball} ${appname} ${name} + +echo -n "Downloading ${tarball} ... " +wget -q https://github.com/traefik/traefik/releases/download/${version}/${tarball} +echo "" + +echo -n "Unpacking traefik ... " +mkdir -p ./$appname +tar xzf $tarball -C ./$appname +echo "" + +echo -n "Setting up GO env ... " +export GOPATH=~/go +export PATH=$PATH:$GOPATH/bin +echo "" + +#echo -n "Building traefik ... " +#make clean-webui -C ${appname} +#echo "" + +pushd ${appname} + +echo "${appname}: Running GO get ..." +go get && +go mod tidy && +go generate && +go build -buildmode=pie \ + -ldflags "-linkmode 'external' -extldflags '-static-pie'" \ + -tags netgo \ + ./cmd/traefik + +popd +0 + +if test -f ${appname}/${name}; then + ln -s ${appname}/${name} ./${name} +fi