fix ci and docker build
This commit is contained in:
parent
262e8e2047
commit
a95fe42efe
22
Makefile
22
Makefile
|
@ -10,7 +10,12 @@ IMAGE=h44z/wg-portal
|
||||||
|
|
||||||
all: dep build
|
all: dep build
|
||||||
|
|
||||||
build: dep $(addprefix $(BUILDDIR)/,$(BINARIES))
|
build: dep $(addsuffix -amd64,$(addprefix $(BUILDDIR)/,$(BINARIES)))
|
||||||
|
cp -r assets $(BUILDDIR)
|
||||||
|
cp scripts/wg-portal.service $(BUILDDIR)
|
||||||
|
cp scripts/wg-portal.env $(BUILDDIR)
|
||||||
|
|
||||||
|
build-cross-plat: dep build $(addsuffix -arm,$(addprefix $(BUILDDIR)/,$(BINARIES))) $(addsuffix -arm64,$(addprefix $(BUILDDIR)/,$(BINARIES)))
|
||||||
cp -r assets $(BUILDDIR)
|
cp -r assets $(BUILDDIR)
|
||||||
cp scripts/wg-portal.service $(BUILDDIR)
|
cp scripts/wg-portal.service $(BUILDDIR)
|
||||||
cp scripts/wg-portal.env $(BUILDDIR)
|
cp scripts/wg-portal.env $(BUILDDIR)
|
||||||
|
@ -45,8 +50,13 @@ docker-build:
|
||||||
docker-push:
|
docker-push:
|
||||||
docker push $(IMAGE)
|
docker push $(IMAGE)
|
||||||
|
|
||||||
# For arch install: arm-linux-gnueabihf-gcc and aarch64-linux-gnu-gcc to crosscompile for arm
|
$(BUILDDIR)/%-amd64: cmd/%/main.go dep phony
|
||||||
$(BUILDDIR)/%: cmd/%/main.go dep phony
|
GOOS=linux GOARCH=amd64 $(GOCMD) build -o $@ $<
|
||||||
GOOS=linux GOARCH=amd64 $(GOCMD) build -o $@-amd64 $<
|
|
||||||
CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@-arm64 $<
|
# On arch-linux install aarch64-linux-gnu-gcc to crosscompile for arm64
|
||||||
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc GOOS=linux GOARCH=arm GOARM=7 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@-arm $<
|
$(BUILDDIR)/%-arm64: cmd/%/main.go dep phony
|
||||||
|
CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@ $<
|
||||||
|
|
||||||
|
# On arch-linux install arm-linux-gnueabihf-gcc to crosscompile for arm
|
||||||
|
$(BUILDDIR)/%-arm: cmd/%/main.go dep phony
|
||||||
|
CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc GOOS=linux GOARCH=arm GOARM=7 $(GOCMD) build -ldflags "-linkmode external -extldflags -static" -o $@ $<
|
|
@ -13,7 +13,7 @@ To compile the final binary, use the Makefile provided in the repository.
|
||||||
As WireGuard Portal is written in Go, **golang >= 1.14** must be installed prior to building.
|
As WireGuard Portal is written in Go, **golang >= 1.14** must be installed prior to building.
|
||||||
|
|
||||||
```
|
```
|
||||||
make
|
make build-cross-plat
|
||||||
```
|
```
|
||||||
|
|
||||||
The compiled binary and all necessary assets will be located in the dist folder.
|
The compiled binary and all necessary assets will be located in the dist folder.
|
||||||
|
|
|
@ -74,6 +74,9 @@ For a standalone application, use the Makefile provided in the repository to bui
|
||||||
|
|
||||||
```
|
```
|
||||||
make
|
make
|
||||||
|
|
||||||
|
# To build for arm architecture as well use:
|
||||||
|
make build-cross-plat
|
||||||
```
|
```
|
||||||
|
|
||||||
The compiled binary and all necessary assets will be located in the dist folder.
|
The compiled binary and all necessary assets will be located in the dist folder.
|
||||||
|
|
Loading…
Reference in New Issue