mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-23 10:24:15 +00:00
Better Dockerfile
This commit is contained in:
parent
1976d02ec9
commit
55890672f5
1 changed files with 10 additions and 1 deletions
11
.github/docker/Dockerfile
vendored
11
.github/docker/Dockerfile
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue