mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
build: generate fingerprinted assets before compile
This commit is contained in:
parent
cfb169d2fb
commit
5ad2203f24
3 changed files with 20 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ COPY . .
|
||||||
|
|
||||||
ENV CGO_ENABLED=1
|
ENV CGO_ENABLED=1
|
||||||
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
ENV CGO_CFLAGS="-D_LARGEFILE64_SOURCE"
|
||||||
|
RUN go run ./cmd/genassets
|
||||||
RUN go build -ldflags "-w -s" -o build/x-ui main.go
|
RUN go build -ldflags "-w -s" -o build/x-ui main.go
|
||||||
RUN ./DockerInit.sh "$TARGETARCH"
|
RUN ./DockerInit.sh "$TARGETARCH"
|
||||||
|
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -30,6 +30,17 @@ bash <(curl -Ls https://raw.githubusercontent.com/Sora39831/3x-ui/master/install
|
||||||
|
|
||||||
For full documentation, please visit the [project Wiki](https://github.com/Sora39831/3x-ui/wiki).
|
For full documentation, please visit the [project Wiki](https://github.com/Sora39831/3x-ui/wiki).
|
||||||
|
|
||||||
|
## Building from source
|
||||||
|
|
||||||
|
Generate fingerprinted frontend assets before compiling:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go run ./cmd/genassets
|
||||||
|
go build -ldflags "-w -s" -o build/x-ui main.go
|
||||||
|
```
|
||||||
|
|
||||||
|
Production builds embed files from `web/public/assets` and `web/public/assets-manifest.json`.
|
||||||
|
|
||||||
## A Special Thanks to
|
## A Special Thanks to
|
||||||
|
|
||||||
- [alireza0](https://github.com/alireza0/)
|
- [alireza0](https://github.com/alireza0/)
|
||||||
|
|
|
||||||
|
|
@ -85,3 +85,11 @@ func TestAssetRequestCacheControlDoesNotMarkMissingFingerprintPathImmutable(t *t
|
||||||
t.Fatalf("expected missing asset path to avoid immutable cache-control, got %q", got)
|
t.Fatalf("expected missing asset path to avoid immutable cache-control, got %q", got)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAssetCacheControlForLogicalPathIsShortLived(t *testing.T) {
|
||||||
|
got := assetCacheControl("js/websocket.js")
|
||||||
|
want := "public, max-age=300"
|
||||||
|
if got != want {
|
||||||
|
t.Fatalf("expected %q, got %q", want, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue