mirror of
https://github.com/Threnklyn/wg-ui.git
synced 2026-06-07 14:03:33 +02:00
update makefile and documentation (#74)
This commit is contained in:
@@ -45,19 +45,16 @@ jobs:
|
||||
|
||||
- name: npm install & build
|
||||
run: |
|
||||
npm install --prefix ui
|
||||
npm run --prefix ui build
|
||||
make ui
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '1.14'
|
||||
|
||||
- name: Fetch Go dependencies
|
||||
- name: Insert assets into go
|
||||
run: |
|
||||
go get -u github.com/go-bindata/go-bindata/...
|
||||
go get github.com/elazarl/go-bindata-assetfs/...
|
||||
go-bindata-assetfs -prefix ui/dist ui/dist
|
||||
make assets
|
||||
|
||||
- name: Build wg-ui for Linux (AMD64)
|
||||
run: |
|
||||
@@ -66,7 +63,7 @@ jobs:
|
||||
target=linux-amd64
|
||||
release_name="$name-$tag-$target"
|
||||
release_tar="$release_name.tar.gz"
|
||||
env CGO_ENABLED=0 go build -o "$release_name"
|
||||
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "$release_name"
|
||||
tar czvf "$release_tar" "$release_name"
|
||||
echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256"
|
||||
rm "$release_name"
|
||||
@@ -114,7 +111,7 @@ jobs:
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get -qq -y install buildah
|
||||
|
||||
- name: Build & push wg-ui Docker image
|
||||
- name: Build & push wg-ui to docker hub
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
+5
-5
@@ -5,17 +5,17 @@ RUN npm install
|
||||
COPY ui .
|
||||
RUN npm run build
|
||||
|
||||
FROM docker.io/golang:1.13 AS build
|
||||
FROM docker.io/golang:1.14 AS build
|
||||
WORKDIR /wg
|
||||
RUN go get github.com/go-bindata/go-bindata/... &&\
|
||||
go get github.com/elazarl/go-bindata-assetfs/...
|
||||
RUN go get github.com/go-bindata/go-bindata/...
|
||||
RUN go get github.com/elazarl/go-bindata-assetfs/...
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
COPY --from=ui /ui/dist ui/dist
|
||||
RUN go-bindata-assetfs -prefix ui/dist ui/dist &&\
|
||||
go install .
|
||||
RUN go-bindata-assetfs -prefix ui/dist ui/dist
|
||||
RUN go install .
|
||||
|
||||
FROM gcr.io/distroless/base
|
||||
COPY --from=build /go/bin/wireguard-ui /
|
||||
|
||||
@@ -1,19 +1,47 @@
|
||||
.PHONY: binary container ui
|
||||
# Parameters
|
||||
GOCMD=go
|
||||
GOBUILD=$(GOCMD) build
|
||||
GOCLEAN=$(GOCMD) clean
|
||||
GOGET=$(GOCMD) get
|
||||
BINARY_NAME=wireguard-ui
|
||||
|
||||
binary: go-binary ui
|
||||
.PHONY: build container ui assets
|
||||
|
||||
go-binary:
|
||||
go-bindata-assetfs -prefix ui/dist ui/dist
|
||||
go build .
|
||||
all: build
|
||||
|
||||
clean:
|
||||
$(GOCLEAN)
|
||||
rm -rf bin
|
||||
rm -rf ui/node_modules ui/dist
|
||||
|
||||
ui:
|
||||
cd ui && npm install && npm run build
|
||||
|
||||
assets:
|
||||
$(GOGET) github.com/go-bindata/go-bindata/...
|
||||
$(GOGET) github.com/elazarl/go-bindata-assetfs/...
|
||||
go-bindata-assetfs -prefix ui/dist ui/dist
|
||||
|
||||
build: ui assets
|
||||
CGO_ENABLED=0 $(GOBUILD) -o bin/$(BINARY_NAME) -v
|
||||
|
||||
build-amd64: ui assets
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o bin/$(BINARY_NAME)-amd64 -v
|
||||
|
||||
build-armv5: ui assets
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 $(GOBUILD) -o bin/$(BINARY_NAME)-armv5 -v
|
||||
|
||||
build-armv6: ui assets
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o bin/$(BINARY_NAME)-armv6 -v
|
||||
|
||||
build-armv7: ui assets
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o bin/$(BINARY_NAME)-armv7 -v
|
||||
|
||||
container:
|
||||
docker build -t wireguard-ui .
|
||||
|
||||
run-dev: go-binary
|
||||
sudo ./wireguard-ui --log-level=debug --dev-ui-server=http://localhost:5000
|
||||
run-dev:
|
||||
sudo ./bin/$(BINARY_NAME) --log-level=debug --dev-ui-server=http://localhost:5000
|
||||
|
||||
run-dev-ui: ui
|
||||
run-dev-ui:
|
||||
cd ui && npm run dev
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# WireGuard UI
|
||||
|
||||
[](https://github.com/EmbarkStudios/wg-ui/actions)
|
||||
[](https://github.com/EmbarkStudios/wg-ui/actions)
|
||||
[](https://github.com/EmbarkStudios)
|
||||
[](CODE_OF_CONDUCT.md)
|
||||
|
||||
@@ -13,7 +13,7 @@ Current stable release: [v1.1.0](https://github.com/EmbarkStudios/wg-ui/releases
|
||||
* QR-Code for convenient mobile client configuration
|
||||
* Optional multi-user support behind an authenticating proxy
|
||||
* Zero external dependencies - just a single binary using the wireguard kernel module
|
||||
* Container-first deployment
|
||||
* Binary and container deployment
|
||||
|
||||

|
||||
|
||||
@@ -80,24 +80,36 @@ curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
|
||||
git clone https://github.com/EmbarkStudios/wg-ui.git && cd wg-ui
|
||||
```
|
||||
|
||||
### Build frontend
|
||||
### Build binary with ui
|
||||
|
||||
```
|
||||
make build
|
||||
```
|
||||
|
||||
### Crosscompiling
|
||||
|
||||
```
|
||||
make build-amd64
|
||||
```
|
||||
|
||||
```
|
||||
make build-armv5
|
||||
```
|
||||
|
||||
```
|
||||
make build-armv6
|
||||
```
|
||||
|
||||
```
|
||||
make build-armv7
|
||||
```
|
||||
|
||||
### Build step by step
|
||||
|
||||
```
|
||||
make ui
|
||||
```
|
||||
|
||||
### Build Go binary
|
||||
|
||||
```
|
||||
go get -u github.com/go-bindata/go-bindata/...
|
||||
go get github.com/elazarl/go-bindata-assetfs/...
|
||||
make go-binary
|
||||
```
|
||||
|
||||
### Build Go binary for ARM
|
||||
|
||||
```
|
||||
env GOOS=linux GOARCH=arm GOARM=5 go build .
|
||||
make assets
|
||||
make build
|
||||
```
|
||||
|
||||
## Developing
|
||||
@@ -111,10 +123,8 @@ npm run --prefix=ui dev
|
||||
### Use frontend server when running the server
|
||||
|
||||
```
|
||||
go get -u github.com/go-bindata/go-bindata/...
|
||||
go get github.com/elazarl/go-bindata-assetfs/...
|
||||
make go-binary
|
||||
sudo ./wireguard-ui --log-level=debug --dev-ui-server http://localhost:5000
|
||||
make build
|
||||
sudo ./bin/wireguard-ui --log-level=debug --dev-ui-server http://localhost:5000
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Reference in New Issue
Block a user