Skip to content

Commit ba2a13b

Browse files
committed
build: semi-automated build and packaging for amd64, arm64 for linux, windows and macos plus packaging into deb, rpm, pkg
1 parent b3836bd commit ba2a13b

5 files changed

Lines changed: 132 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@
2626
**/Caddyfile
2727

2828
**/app/bin/*
29+
**/app/dist/*

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<p align="center">
2-
<img src="wireport-with-slogan.png" alt="wireport logo" width="200" />
2+
<img src="assets/wireport-with-slogan.png" alt="wireport logo" width="200" />
33
</p>
44

55
<h1 align="center" style="color:#23132d">
66
wireport
77
</h1>
88

99
<p align="center">
10-
<strong>Self-hosted subnet proxy / VPN tunnel that securely exposes private Docker services to the Internet and local environment.</strong><br />
10+
<strong>Self-hosted subnet proxy and VPN tunnel that securely exposes private Docker services to the Internet and local environment.</strong><br />
1111
Powered by WireGuard, CoreDNS and Caddy
1212
</p>
1313

@@ -22,7 +22,7 @@
2222

2323
# wireport
2424

25-
**wireport** is a self-hosted subnet proxy / VPN tunnel that securely exposes private Docker services to the Internet and local environment. Powered by WireGuard (networking), CoreDNS and Caddy (reverse proxy).
25+
**wireport** is a self-hosted subnet proxy and VPN tunnel that securely exposes private Docker services to the Internet and local environment. Powered by WireGuard (networking), CoreDNS and Caddy (reverse proxy).
2626

2727
- Secure tunneling into remote development/staging/production environments to facilitate debugging and troubleshooting of remote Docker-based services
2828
- Exposing Docker services, running in a local network (e.g., a NAS or a home server), to the Internet

app/Makefile

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
VERSION ?= 0.8.0
2+
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
3+
DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
4+
OUT_PATH ?= dist
5+
BIN_PATH := bin
6+
PKG_NAME := wireport
7+
GO_MODULE := wireport
8+
ARCHS := amd64 arm64
9+
OSES := linux darwin windows
10+
11+
# Package metadata
12+
PKG_DESCRIPTION := wireport - subnet proxy and VPN tunnel
13+
PKG_MAINTAINER := MultionLabs <team@multionlabs.com>
14+
PKG_VENDOR := MultionLabs
15+
PKG_HOMEPAGE := https://github.com/MultionLabs/wireport
16+
17+
# Docker image for building packages
18+
FPM_IMAGE := debian:bookworm-slim
19+
20+
build-pkgs: build-binaries build-deb build-rpm build-macos
21+
22+
build-binaries:
23+
@mkdir -p $(BIN_PATH)
24+
@$(foreach os,$(OSES), \
25+
$(foreach arch,$(ARCHS), \
26+
echo "Building for $(os)-$(arch)..."; \
27+
CGO_ENABLED=0 GOOS=$(os) GOARCH=$(arch) go build \
28+
-ldflags "-X '$(GO_MODULE)/version.Version=$(VERSION)' -X '$(GO_MODULE)/version.Arch=$(arch)' -X '$(GO_MODULE)/version.OS=$(os)' -X '$(GO_MODULE)/version.Commit=$(COMMIT)' -X '$(GO_MODULE)/version.Date=$(DATE)'" \
29+
-o $(BIN_PATH)/$(PKG_NAME)-$(os)-$(arch)$(if $(filter windows,$(os)),.exe,) ./cmd/server;))
30+
31+
build-deb:
32+
@mkdir -p $(OUT_PATH)
33+
@echo "Building Debian packages for Linux..."
34+
@$(foreach arch,$(ARCHS), \
35+
echo " Building for linux-$(arch)..."; \
36+
fpm -s dir -t deb -n $(PKG_NAME) -v $(VERSION) -a $(arch) \
37+
--description "$(PKG_DESCRIPTION)" \
38+
--maintainer "$(PKG_MAINTAINER)" \
39+
--vendor "$(PKG_VENDOR)" \
40+
--url "$(PKG_HOMEPAGE)" \
41+
--force \
42+
--depends iptables \
43+
--depends wireguard-tools \
44+
--depends iproute2 \
45+
-p $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_debian_$(arch).deb \
46+
$(BIN_PATH)/$(PKG_NAME)-linux-$(arch)=/usr/bin/$(PKG_NAME);)
47+
48+
build-rpm:
49+
@mkdir -p $(OUT_PATH)
50+
@echo "Building RPM packages for Linux..."
51+
@$(foreach arch,$(ARCHS), \
52+
echo " Building for linux-$(arch)..."; \
53+
fpm -s dir -t rpm -n $(PKG_NAME) -v $(VERSION) -a $(arch) \
54+
--description "$(PKG_DESCRIPTION)" \
55+
--maintainer "$(PKG_MAINTAINER)" \
56+
--vendor "$(PKG_VENDOR)" \
57+
--url "$(PKG_HOMEPAGE)" \
58+
--force \
59+
--depends iptables \
60+
--depends wireguard-tools \
61+
--depends iproute \
62+
-p $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_rpm_$(arch).rpm \
63+
$(BIN_PATH)/$(PKG_NAME)-linux-$(arch)=/usr/bin/$(PKG_NAME);)
64+
65+
build-macos:
66+
@mkdir -p $(OUT_PATH)
67+
@echo "Building macOS packages..."
68+
@$(foreach arch,$(ARCHS), \
69+
echo " Building for darwin-$(arch)..."; \
70+
fpm -s dir -t osxpkg -n $(PKG_NAME) -v $(VERSION) -a $(arch) \
71+
--description "$(PKG_DESCRIPTION)" \
72+
--maintainer "$(PKG_MAINTAINER)" \
73+
--vendor "$(PKG_VENDOR)" \
74+
--url "$(PKG_HOMEPAGE)" \
75+
--force \
76+
--osxpkg-identifier-prefix com.multionlabs \
77+
-p $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_macos_$(arch).pkg \
78+
$(BIN_PATH)/$(PKG_NAME)-darwin-$(arch)=/usr/local/bin/$(PKG_NAME);)
79+
80+
build-pkgs-docker: build-binaries build-deb-docker build-rpm-docker
81+
82+
build-deb-docker:
83+
@mkdir -p $(OUT_PATH)
84+
@echo "Building Debian packages using Docker..."
85+
@$(foreach arch,$(ARCHS), \
86+
echo " Building for linux-$(arch)..."; \
87+
docker run --rm -v $(PWD):/workspace -w /workspace $(FPM_IMAGE) \
88+
bash -c "apt-get update && \
89+
apt-get install -y ruby ruby-dev build-essential && \
90+
gem install fpm && \
91+
rm -f $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_debian_$(arch).deb && \
92+
fpm -s dir -t deb -n $(PKG_NAME) -v $(VERSION) -a $(arch) \
93+
--description '$(PKG_DESCRIPTION)' \
94+
--maintainer '$(PKG_MAINTAINER)' \
95+
--vendor '$(PKG_VENDOR)' \
96+
--url '$(PKG_HOMEPAGE)' \
97+
--depends iptables \
98+
--depends wireguard-tools \
99+
--depends iproute2 \
100+
-p $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_debian_$(arch).deb \
101+
$(BIN_PATH)/$(PKG_NAME)-linux-$(arch)=/usr/bin/$(PKG_NAME)";)
102+
103+
build-rpm-docker:
104+
@mkdir -p $(OUT_PATH)
105+
@echo "Building RPM packages using Docker..."
106+
@$(foreach arch,$(ARCHS), \
107+
echo " Building for linux-$(arch)..."; \
108+
docker run --rm -v $(PWD):/workspace -w /workspace $(FPM_IMAGE) \
109+
bash -c "apt-get update && \
110+
apt-get install -y ruby ruby-dev build-essential rpm && \
111+
gem install fpm && \
112+
rm -f $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_rpm_$(arch).rpm && \
113+
fpm -s dir -t rpm -n $(PKG_NAME) -v $(VERSION) -a $(arch) \
114+
--description '$(PKG_DESCRIPTION)' \
115+
--maintainer '$(PKG_MAINTAINER)' \
116+
--vendor '$(PKG_VENDOR)' \
117+
--url '$(PKG_HOMEPAGE)' \
118+
--depends iptables \
119+
--depends wireguard-tools \
120+
--depends iproute \
121+
-p $(OUT_PATH)/$(PKG_NAME)_$(VERSION)-1_rpm_$(arch).rpm \
122+
$(BIN_PATH)/$(PKG_NAME)-linux-$(arch)=/usr/bin/$(PKG_NAME)";)
123+
124+
125+
clean:
126+
@echo "Cleaning build artifacts..."
127+
@rm -rf $(BIN_PATH) $(OUT_PATH)

app/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package version
22

33
var (
4-
Version = "1.0.0"
4+
Version = "unknown"
55
Commit = "unknown"
66
Date = "unknown"
77
Arch = "unknown"

0 commit comments

Comments
 (0)