From 55890672f530c67f785abfab41b22a6ec983dbee Mon Sep 17 00:00:00 2001 From: hoodad Date: Sun, 13 Jul 2025 05:28:02 +0000 Subject: [PATCH] Better Dockerfile --- .github/docker/Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile index 0b6f2932..0075656c 100644 --- a/.github/docker/Dockerfile +++ b/.github/docker/Dockerfile @@ -1,12 +1,21 @@ # syntax=docker/dockerfile:latest FROM --platform=$BUILDPLATFORM golang:latest AS build + +LABEL org.opencontainers.image.source="https://github.com/XTLS/Xray-core" \ + org.opencontainers.image.licenses="MPL-2.0" \ + org.opencontainers.image.title="xray-core" + # Build xray-core WORKDIR /src + +COPY go.mod go.sum ./ +RUN go mod download + COPY . . ARG TARGETOS ARG TARGETARCH -RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main +RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main # Download geodat into a staging directory ADD https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat /tmp/geodat/geoip.dat