github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/.github/docker/Dockerfile (about)

     1  # syntax=docker/dockerfile:1
     2  FROM --platform=$BUILDPLATFORM golang:alpine AS build
     3  WORKDIR /src
     4  COPY . .
     5  ARG TARGETOS TARGETARCH
     6  RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
     7  
     8  FROM --platform=${TARGETPLATFORM} alpine:latest
     9  WORKDIR /root
    10  COPY .github/docker/files/config.json /etc/xray/config.json
    11  COPY --from=build /src/xray /usr/bin/xray
    12  RUN set -ex \
    13  	&& apk add --no-cache tzdata ca-certificates \
    14  	&& mkdir -p /var/log/xray /usr/share/xray \
    15      && chmod +x /usr/bin/xray \
    16  	&& wget -O /usr/share/xray/geosite.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat \
    17  	&& wget -O /usr/share/xray/geoip.dat https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
    18  
    19  VOLUME /etc/xray
    20  ENV TZ=Asia/Shanghai
    21  ENTRYPOINT [ "/usr/bin/xray" ]
    22  CMD [ "-config", "/etc/xray/config.json" ]