fix: migrate to wg-portal-2

This commit is contained in:
fedorHub 2025-08-28 15:55:52 +02:00
parent 7c47759b89
commit 5d404d5c3a
No known key found for this signature in database
GPG Key ID: 7FDE5B4177850E7D
5 changed files with 16 additions and 49 deletions

View File

@ -36,16 +36,16 @@ ARG BUILD_VERSION
# Split to cross-platform build
ARG TARGETARCH
# Build the application
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} go build -o /build/dist/wg-portal \
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} go build -o /build/dist/wg-portal-2 \
-ldflags "-w -s -extldflags '-static' -X 'github.com/fedor-git/wg-portal-2/internal.Version=${BUILD_VERSION}'" \
-tags netgo \
cmd/wg-portal/main.go
./cmd/wg-portal-2
######
# Export binaries
######
FROM scratch AS binaries
COPY --from=builder /build/dist/wg-portal /
COPY --from=builder /build/dist/wg-portal-2 /
######
# Final image
@ -56,7 +56,7 @@ RUN apk add --no-cache bash curl iptables nftables openresolv wireguard-tools
# Setup timezone
ENV TZ=UTC
# Copy binaries
COPY --from=builder /build/dist/wg-portal /app/wg-portal
COPY --from=builder /build/dist/wg-portal-2 /app/wg-portal-2
# Set the Current Working Directory inside the container
WORKDIR /app
# Expose default ports for metrics, web and wireguard
@ -66,4 +66,4 @@ EXPOSE 51820/udp
# the database and config file can be mounted from the host
VOLUME [ "/app/data", "/app/config" ]
# Command to run the executable
ENTRYPOINT [ "/app/wg-portal" ]
ENTRYPOINT [ "/app/wg-portal-2" ]

View File

@ -78,7 +78,7 @@ build: build-dependencies
CGO_ENABLED=0 $(GOCMD) build -o $(BUILDDIR)/wg-portal \
-ldflags "-w -s -extldflags \"-static\" -X 'github.com/fedor-git/wg-portal-2/internal/server.Version=${ENV_BUILD_IDENTIFIER}-${ENV_BUILD_VERSION}'" \
-tags netgo \
cmd/wg-portal/main.go
cmd/wg-portal-2/main.go
#< build-amd64: Build all executables for AMD64
.PHONY: build-amd64
@ -86,7 +86,7 @@ build-amd64: build-dependencies
CGO_ENABLED=0 $(GOCMD) build -o $(BUILDDIR)/wg-portal-amd64 \
-ldflags "-w -s -extldflags \"-static\" -X 'github.com/fedor-git/wg-portal-2/internal/server.Version=${ENV_BUILD_IDENTIFIER}-${ENV_BUILD_VERSION}'" \
-tags netgo \
cmd/wg-portal/main.go
cmd/wg-portal-2/main.go
#< build-arm64: Build all executables for ARM64
.PHONY: build-arm64
@ -94,7 +94,7 @@ build-arm64: build-dependencies
CGO_ENABLED=0 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 $(GOCMD) build -o $(BUILDDIR)/wg-portal-arm64 \
-ldflags "-w -s -extldflags \"-static\" -X 'github.com/fedor-git/wg-portal-2/internal/server.Version=${ENV_BUILD_IDENTIFIER}-${ENV_BUILD_VERSION}'" \
-tags netgo \
cmd/wg-portal/main.go
cmd/wg-portal-2/main.go
#< build-arm: Build all executables for ARM32
.PHONY: build-arm
@ -102,14 +102,14 @@ build-arm: build-dependencies
CGO_ENABLED=0 CC=arm-linux-gnueabi-gcc GOOS=linux GOARCH=arm GOARM=7 $(GOCMD) build -o $(BUILDDIR)/wg-portal-arm \
-ldflags "-w -s -extldflags \"-static\" -X 'github.com/fedor-git/wg-portal-2/internal/server.Version=${ENV_BUILD_IDENTIFIER}-${ENV_BUILD_VERSION}'" \
-tags netgo \
cmd/wg-portal/main.go
cmd/wg-portal-2/main.go
#< build-dependencies: Generate the output directory for compiled executables and download dependencies
.PHONY: build-dependencies
build-dependencies:
@$(GOCMD) mod download -x
@mkdir -p $(BUILDDIR)
cp scripts/wg-portal.service $(BUILDDIR)
cp scripts/wg-portal-2.service $(BUILDDIR)
#< frontend: Build Vue.js frontend
frontend: frontend-dependencies

View File

@ -1,39 +0,0 @@
package models
import (
"github.com/fedor-git/wg-portal-2/internal"
"github.com/fedor-git/wg-portal-2/internal/domain"
)
type ConfigOption[T any] struct {
Value T `json:"Value"`
Overridable bool `json:"Overridable,omitempty"`
}
func ConfigOptionFromDomain[T any](opt domain.ConfigOption[T]) ConfigOption[T] {
return ConfigOption[T]{
Value: opt.Value,
Overridable: opt.Overridable,
}
}
func ConfigOptionToDomain[T any](opt ConfigOption[T]) domain.ConfigOption[T] {
return domain.ConfigOption[T]{
Value: opt.Value,
Overridable: opt.Overridable,
}
}
func StringSliceConfigOptionFromDomain(opt domain.ConfigOption[string]) ConfigOption[[]string] {
return ConfigOption[[]string]{
Value: internal.SliceString(opt.Value),
Overridable: opt.Overridable,
}
}
func StringSliceConfigOptionToDomain(opt ConfigOption[[]string]) domain.ConfigOption[string] {
return domain.ConfigOption[string]{
Value: internal.SliceToString(opt.Value),
Overridable: opt.Overridable,
}
}

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "wg-portal-2",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}