diff --git a/PKGBUILD b/PKGBUILD index 54bf855..3e085ee 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=traefik pkgver=2.2.1 -pkgrel=1 +pkgrel=2 pkgdesc="Modern reverse proxy written in Go" arch=('x86_64') url="https://containo.us/traefik/" @@ -10,14 +10,14 @@ license=('MIT') makedepends=('go-pie' 'git' 'go-bindata-hashicorp') depends=('glibc') backup=('etc/traefik/traefik.toml' - 'etc/traefik/traefik.yaml' - 'etc/traefik/traefik.yml') + 'etc/traefik/traefik.yaml' + 'etc/traefik/traefik.yml') source=("${pkgname}-${pkgver}.tar.gz::https://github.com/containous/traefik/releases/download/v${pkgver}/traefik-v${pkgver}.src.tar.gz" - 'traefik.service' - 'traefik.sysusers') + 'traefik.service' + 'traefik.sysusers') noextract=("${pkgname}-${pkgver}.tar.gz") sha512sums=('f23a58632cbef5c3326b464f9c85f59f2d29ed799d392da544f66c40113e3f08b504c35867479603c697c4ee660401ae2ac4596288bcb9de348ddbe597dea45c' - '474dc8274d160bf46a46edf8855378331521b108a767345fb8cb201f23576ceadbee81560d15cf98cac3a978eb24b49f951524da828ffda720797f7ab38bd49c' + '25ab1113bb69936c443fe49d5d3da7d39171fc82e8fa06f46ed4e2dfcaa89685d50ca50b58c32215852d79e5c8d4736a287c15b75420c78a853c51502cb2641a' '5fecfed5df77bf28c2c976ebaebedb030904d41509e740821140a4889bda20327f416e78f8d19b0ee78c8bc422d1907ce05ef3562e4d3e36ddfbdbea5e860b2a') prepare() { @@ -26,10 +26,15 @@ prepare() { } build() { + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw" cd "${srcdir}/${pkgname}-${pkgver}" go generate cd cmd/traefik - go build -trimpath -ldflags "-extldflags ${LDFLAGS}" + go build } check() { @@ -43,4 +48,7 @@ package() { install -Dm644 LICENSE.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" install -Dm644 "${srcdir}/traefik.service" "${pkgdir}/usr/lib/systemd/system/traefik.service" install -Dm644 "${srcdir}/traefik.sysusers" "${pkgdir}/usr/lib/sysusers.d/traefik.conf" + # create empty acme.json file, otherwise the service file will fail + mkdir -p "${pkgdir}/etc/traefik/" + touch "${pkgdir}/etc/traefik/acme.json" } diff --git a/traefik.service b/traefik.service index 72dafa6..2fc0133 100644 --- a/traefik.service +++ b/traefik.service @@ -3,7 +3,6 @@ Description=Traefik Documentation=https://docs.traefik.io After=network-online.target AssertFileIsExecutable=/usr/bin/traefik -AssertPathExists=/etc/traefik/traefik.toml [Service] # Run traefik as its own user (create new user with: useradd -r -s /bin/false -U -M traefik) @@ -12,7 +11,7 @@ AmbientCapabilities=CAP_NET_BIND_SERVICE # configure service behavior Type=notify -ExecStart=/usr/bin/traefik --configFile=/etc/traefik/traefik.toml +ExecStart=/usr/bin/traefik Restart=always WatchdogSec=1s