mirror of
https://github.com/umputun/reproxy.git
synced 2024-11-16 20:25:52 +02:00
add binary distribution with goreleaser
This commit is contained in:
parent
225590da2c
commit
d988d0612c
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
*.test
|
||||
*.out
|
||||
.runconf
|
||||
var/
|
||||
var/
|
||||
dist/
|
53
.goreleaser.yml
Normal file
53
.goreleaser.yml
Normal file
@ -0,0 +1,53 @@
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
ignore:
|
||||
- goos: freebsd
|
||||
goarch: arm
|
||||
- goos: freebsd
|
||||
goarch: arm64
|
||||
dir: app
|
||||
ldflags: "-s -w -X main.revision={{.Tag}}-{{.ShortCommit}}-{{.CommitDate}}"
|
||||
|
||||
archives:
|
||||
- name_template: "{{.ProjectName}}_{{.Tag}}_{{.Os}}_{{.Arch}}"
|
||||
replacements:
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
darwin: macos
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
files:
|
||||
- LICENSE
|
||||
- README.md
|
||||
|
||||
nfpms:
|
||||
-
|
||||
package_name: reproxy
|
||||
file_name_template: "{{.ProjectName}}_{{.Tag}}_{{.Os}}_{{.Arch}}"
|
||||
vendor: Umputun
|
||||
homepage: https://reproxy.io
|
||||
maintainer: Umputun <umputun@gmail.com>
|
||||
description: reverse proxy
|
||||
license: MIT
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
bindir: /usr/bin
|
||||
epoch: 1
|
||||
release: 1
|
||||
files:
|
||||
"reproxy.service": "/etc/systemd/system/reproxy.service"
|
||||
"reproxy-example.yml": "/etc/reproxy-example.yml"
|
||||
scripts:
|
||||
postinstall: "scripts/postinstall.sh"
|
||||
preremove: "scripts/preremove.sh"
|
19
Dockerfile.artifacts
Normal file
19
Dockerfile.artifacts
Normal file
@ -0,0 +1,19 @@
|
||||
FROM goreleaser/goreleaser as build
|
||||
|
||||
WORKDIR /build
|
||||
ADD . /build
|
||||
|
||||
RUN goreleaser --snapshot --skip-publish --rm-dist
|
||||
|
||||
FROM alpine
|
||||
COPY --from=build /build/dist/ /dist/
|
||||
RUN \
|
||||
mkdir -p /artifacts && \
|
||||
cp /dist/*.gz /artifacts/ && \
|
||||
cp /dist/*.zip /artifacts/ && \
|
||||
cp /dist/*.txt /artifacts/ && \
|
||||
cp /dist/*.rpm /artifacts/ && \
|
||||
cp /dist/*.deb /artifacts/ && \
|
||||
ls -la /artifacts/*
|
||||
|
||||
CMD ["sleep", "100"]
|
15
Makefile
Normal file
15
Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
docker:
|
||||
docker build -t umputun/reproxy .
|
||||
|
||||
dist:
|
||||
- @mkdir -p dist
|
||||
docker build -f Dockerfile.artifacts -t reproxy.bin .
|
||||
- @docker rm -f reproxy.bin 2>/dev/null || exit 0
|
||||
docker run -d --name=reproxy.bin reproxy.bin
|
||||
docker cp reproxy.bin:/artifacts dist/
|
||||
docker rm -f reproxy.bin
|
||||
|
||||
race_test:
|
||||
cd app && go test -race -mod=vendor -timeout=60s -count 1 ./...
|
||||
|
||||
.PHONY: dist docker race_test
|
5
reproxy-example.yml
Normal file
5
reproxy-example.yml
Normal file
@ -0,0 +1,5 @@
|
||||
default:
|
||||
- {route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8080/blah1/$1"}
|
||||
- {route: "/api/svc3/xyz", dest: "http://127.0.0.3:8080/blah3/xyz", "ping": "http://127.0.0.3:8080/ping"}
|
||||
srv.example.com:
|
||||
- {route: "^/api/svc2/(.*)", dest: "http://127.0.0.2:8080/blah2/$1/abc"}
|
14
reproxy.service
Normal file
14
reproxy.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Reverse proxy service
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
User=root
|
||||
ExecStart=/usr/bin/reproxy -f /etc/reproxy.yml -u
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
3
scripts/postinstall.sh
Normal file
3
scripts/postinstall.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
systemctl start reproxy
|
||||
systemctl enable reproxy
|
3
scripts/preremove.sh
Normal file
3
scripts/preremove.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
systemctl stop reproxy
|
||||
systemctl disable reproxy
|
Loading…
Reference in New Issue
Block a user