mirror of
https://github.com/unpoller/unpoller.git
synced 2026-03-31 06:33:57 -04:00
Update application builder
This commit is contained in:
@@ -12,7 +12,7 @@ name="{{BINARYU}}"
|
||||
real_name="{{BINARY}}"
|
||||
rcvar="{{BINARYU}}_enable"
|
||||
{{BINARYU}}_command="/usr/local/bin/${real_name}"
|
||||
{{BINARYU}}_user="nobody"
|
||||
{{BINARYU}}_user="{{BINARY}}"
|
||||
{{BINARYU}}_config="/usr/local/etc/${real_name}/{{CONFIG_FILE}}"
|
||||
pidfile="/var/run/${real_name}/pid"
|
||||
|
||||
|
||||
22
init/buildinfo.sh
Normal file
22
init/buildinfo.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
# This file is read in by settings.sh.
|
||||
# These values are not generally user configurable and this file is overwritten on upgrades.
|
||||
# Override values in here by setting them in settings.sh; do not change this file.
|
||||
##########
|
||||
|
||||
VENDOR="Go Lift <code@golift.io>"
|
||||
|
||||
# Dynamic. Recommend not changing.
|
||||
VVERSION=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1) 2>/dev/null)
|
||||
VERSION="$(echo $VVERSION | tr -d v | grep -E '^\S+$' || echo development)"
|
||||
# This produces a 0 in some envirnoments (like Homebrew), but it's only used for packages.
|
||||
ITERATION=$(git rev-list --count --all || echo 0)
|
||||
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
COMMIT="$(git rev-parse --short HEAD || echo 0)"
|
||||
|
||||
GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD || echo unknown)"
|
||||
BRANCH="${TRAVIS_BRANCH:-${GIT_BRANCH}}"
|
||||
|
||||
# Defines docker manifest/build types.
|
||||
BUILDS="linux:armhf:arm linux:arm64:arm64 linux:amd64:amd64 linux:i386:386"
|
||||
|
||||
export VENDOR VVERSION VERSION ITERATION DATE BRANCH COMMIT BUILDS
|
||||
@@ -10,7 +10,7 @@ ARG COMMIT=0
|
||||
ARG VERSION=unknown
|
||||
ARG BINARY=application-builder
|
||||
|
||||
FROM golang:stretch as builder
|
||||
FROM golang:latest as builder
|
||||
ARG ARCH
|
||||
ARG OS
|
||||
ARG BINARY
|
||||
@@ -19,7 +19,9 @@ RUN mkdir -p $GOPATH/pkg/mod $GOPATH/bin $GOPATH/src /${BINARY}
|
||||
COPY . /${BINARY}
|
||||
WORKDIR /${BINARY}
|
||||
|
||||
RUN CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS}
|
||||
RUN apt update && \
|
||||
apt install -y upx && \
|
||||
CGO_ENABLED=0 make ${BINARY}.${ARCH}.${OS}
|
||||
|
||||
FROM scratch
|
||||
ARG ARCH
|
||||
@@ -30,7 +32,6 @@ ARG VERSION
|
||||
ARG LICENSE=MIT
|
||||
ARG BINARY
|
||||
ARG SOURCE_URL=http://github.com/golift/application-builder
|
||||
ARG URL=http://github.com/golift/application-builder
|
||||
ARG DESC=application-builder
|
||||
ARG VENDOR=golift
|
||||
ARG AUTHOR=golift
|
||||
@@ -41,7 +42,7 @@ LABEL org.opencontainers.image.created="${BUILD_DATE}" \
|
||||
org.opencontainers.image.title="${BINARY}" \
|
||||
org.opencontainers.image.documentation="${SOURCE_URL}/wiki/Docker" \
|
||||
org.opencontainers.image.description="${DESC}" \
|
||||
org.opencontainers.image.url="${URL}" \
|
||||
org.opencontainers.image.url="${SOURCE_URL}" \
|
||||
org.opencontainers.image.revision="${COMMIT}" \
|
||||
org.opencontainers.image.source="${SOURCE_URL}" \
|
||||
org.opencontainers.image.vendor="${VENDOR}" \
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# Application Builder
|
||||
|
||||
[https://github.com/golift/application-builder](https://github.com/golift/application-builder)
|
||||
|
||||
## Docker Build Hooks
|
||||
|
||||
The files in this folder are used by Docker Cloud to automate image builds.
|
||||
Do not edit these files.
|
||||
|
||||
If you want to build, maintain and push multi-architecture Docker images, you may
|
||||
follow the example provided here. All of the hooks are generic, and will work with
|
||||
any build. Two environment variables must be passed in from Docker Cloud config.
|
||||
|
||||
1. `BUILDS` must be set to the builds you're trying to perform. This repo is currently set to:
|
||||
- `linux:armhf:arm linux:arm64:arm64 linux:amd64:amd64 linux:i386:386`
|
||||
- The format is `os:name:arch`.
|
||||
- `os` and `name` are passed into the Dockerfile.
|
||||
- `os`, `arch` are passed into `docker manifest annotate`.
|
||||
- This does not yet work with an OS other than `linux`.
|
||||
1. Set `DOCKER_CLI_EXPERIMENTAL` to `enabled`. Not optional.
|
||||
|
||||
Keep the build simple; see screenshot. This only supports one build tag, but it creates many more.
|
||||
|
||||

|
||||
|
||||
The fancy source tag is `/^v((\d+\.\d+)(?:\.\d+)?)$/` and it allows you to capture
|
||||
the minor version without patch-level in `{\2}`. I no longer use `{\2}` in my build.
|
||||
[See how it works here](https://regex101.com/r/fzt6ki/1).
|
||||
@@ -9,7 +9,7 @@ set -e -o pipefail
|
||||
# This always run local to the Dockerfile folder, so the path is ../..
|
||||
pushd ../..
|
||||
|
||||
source .metadata.sh
|
||||
source settings.sh
|
||||
|
||||
# Build each configured image from Docker Cloud.
|
||||
for build in $BUILDS; do
|
||||
@@ -24,7 +24,6 @@ for build in $BUILDS; do
|
||||
--build-arg "VERSION=${VERSION}-${ITERATION}" \
|
||||
--build-arg "LICENSE=${LICENSE}" \
|
||||
--build-arg "DESC=${DESC}" \
|
||||
--build-arg "URL=${URL}" \
|
||||
--build-arg "VENDOR=${VENDOR}" \
|
||||
--build-arg "AUTHOR=${MAINT}" \
|
||||
--build-arg "BINARY=${BINARY}" \
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
# This is part of Application Builder.
|
||||
# https://github.com/golift/application-builder
|
||||
|
||||
#set -e -o pipefail
|
||||
|
||||
pushd ../..
|
||||
source .metadata.sh
|
||||
source settings.sh
|
||||
popd
|
||||
|
||||
if [ "$TAGS" == "" ]; then
|
||||
if [ "$BUILDS" != "" ]; then
|
||||
TAGS=$DOCKER_TAG
|
||||
fi
|
||||
|
||||
@@ -26,14 +24,14 @@ for build in $BUILDS; do
|
||||
done
|
||||
echo "Annotating Images: ${IMAGES}"
|
||||
|
||||
# Build all the Docker tags if the source branch is a release and not a branch.
|
||||
# Build all the Docker tags if the source branch is a release and not a branch or pre-release.
|
||||
if [ "v$VERSION" = "$SOURCE_BRANCH" ]; then
|
||||
TAGS="$VERSION $(echo $VERSION | cut -d. -f1,2) $(echo $VERSION | cut -d. -f1)"
|
||||
TAGS="$VERSION"
|
||||
|
||||
echo $SOURCE_BRANCH | grep -q -- -
|
||||
if [ "$?" = "1" ]; then
|
||||
# tag does not contain a dash, so assume it's a prod tag.
|
||||
TAGS="$TAGS latest stable"
|
||||
TAGS="$TAGS latest stable $(echo $VERSION | cut -d. -f1,2) $(echo $VERSION | cut -d. -f1)"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -43,7 +41,7 @@ echo "Version: $VERSION, Source: $SOURCE_BRANCH, Building tags: ${TAGS}"
|
||||
for tag in $TAGS; do
|
||||
docker manifest create --amend ${DOCKER_REPO}:${tag} $IMAGES
|
||||
for build in $BUILDS; do
|
||||
# os:name:arch:variant, ie linux:amd64:amd64: (no variant is ok)
|
||||
# os:name:arch, ie linux:amd64:amd64
|
||||
os=$(echo $build | cut -d: -f1)
|
||||
name=$(echo $build | cut -d: -f2)
|
||||
arch=$(echo $build | cut -d: -f3)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# macOS Homebrew Formula Template. Built by Makefile: `make fomula`
|
||||
# Homebrew Formula Template. Built by Makefile: `make fomula`
|
||||
# This is part of Application Builder.
|
||||
# https://github.com/golift/application-builder
|
||||
# This file is used when FORMULA is set to 'service'.
|
||||
class {{Class}} < Formula
|
||||
desc "{{Desc}}"
|
||||
homepage "{{URL}}"
|
||||
@@ -9,6 +10,7 @@ class {{Class}} < Formula
|
||||
head "{{SOURCE_URL}}"
|
||||
|
||||
depends_on "go" => :build
|
||||
depends_on "upx" => :build
|
||||
|
||||
def install
|
||||
bin_path = buildpath/"#{name}"
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
This file isn't used by the build or for any packages. The homebrew launchd is
|
||||
in the [homebrew](../homebrew) folder. This macOS launchd file is for reference only.
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.github.unifi-poller.unifi-poller</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/unifi-poller</string>
|
||||
<string>-c</string>
|
||||
<string>/usr/local/etc/unifi-poller/up.conf</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/usr/local/var/log/unifi-poller.log</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/usr/local/var/log/unifi-poller.log</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +1,7 @@
|
||||
# Linux Systemd service unit for {{BINARY}}.
|
||||
# Systemd service unit for {{BINARY}}.
|
||||
# This is part of Application Builder.
|
||||
# https://github.com/golift/application-builder
|
||||
# This file is installed when FORMULA is set to 'service'.
|
||||
|
||||
[Unit]
|
||||
Description={{BINARY}} - {{DESC}}
|
||||
@@ -17,7 +18,12 @@ StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier={{BINARY}}
|
||||
Type=simple
|
||||
User=nobody
|
||||
WorkingDirectory=/tmp
|
||||
|
||||
# These should be set correctly for your environment.
|
||||
UMask=0002
|
||||
User={{BINARY}}
|
||||
Group={{BINARY}}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
BIN
init/windows/application.ico
Normal file
BIN
init/windows/application.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
29
init/windows/manifest.xml
Normal file
29
init/windows/manifest.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="unifi-poller" type="win32"/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user