mirror of
https://github.com/samuelhbne/server-xray.git
synced 2025-12-16 11:57:07 +03:00
Unified Dockerfile
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
**
|
||||
|
||||
# Allow only docker duild files
|
||||
!Dockerfile.*
|
||||
!Dockerfile
|
||||
!*.sh
|
||||
!*.tpl
|
||||
12
.github/workflows/docker-buildx-dev.yml
vendored
12
.github/workflows/docker-buildx-dev.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.amd64
|
||||
file: ./Dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.amd64
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ github.repository }}:amd64dev
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.arm64
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ github.repository }}:arm64dev
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.arm
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm/v7
|
||||
push: true
|
||||
tags: ${{ github.repository }}:armv7dev
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.arm
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm/v6
|
||||
push: true
|
||||
tags: ${{ github.repository }}:armdev
|
||||
tags: ${{ github.repository }}:armv6dev
|
||||
|
||||
12
.github/workflows/docker-buildx-latest.yml
vendored
12
.github/workflows/docker-buildx-latest.yml
vendored
@@ -41,7 +41,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.amd64
|
||||
file: ./Dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.amd64
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ github.repository }}:amd64
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.arm64
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ github.repository }}:arm64
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.arm
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm/v7
|
||||
push: true
|
||||
tags: ${{ github.repository }}:armv7
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.arm
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm/v6
|
||||
push: true
|
||||
tags: ${{ github.repository }}:arm
|
||||
tags: ${{ github.repository }}:armv6
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
FROM arm32v6/golang:1.19-alpine as builder
|
||||
|
||||
ARG XRAYVER='v1.7.2'
|
||||
|
||||
RUN apk add --no-cache bash git build-base
|
||||
|
||||
WORKDIR /go/src/XTLS/Xray-core
|
||||
RUN git clone https://github.com/XTLS/Xray-core.git . && \
|
||||
git checkout ${XRAYVER} && \
|
||||
go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
|
||||
|
||||
FROM arm32v6/alpine:3.17
|
||||
|
||||
ARG ACMEVER='2.9.0'
|
||||
|
||||
COPY --from=builder /go/src/XTLS/Xray-core/xray /usr/local/bin/
|
||||
|
||||
RUN apk update && apk add bash nginx openssl curl socat jq moreutils
|
||||
RUN cd /root; curl -sSL "https://github.com/acmesh-official/acme.sh/archive/refs/tags/${ACMEVER}.tar.gz"|tar zxvf -
|
||||
RUN cd /root; mv acme.sh-${ACMEVER} .acme.sh
|
||||
|
||||
COPY site-ssl.conf.tpl /etc/nginx/http.d/
|
||||
COPY grpc.tpl /etc/nginx/http.d/
|
||||
COPY ws.tpl /etc/nginx/http.d/
|
||||
ADD run.sh /run.sh
|
||||
ADD server-ltx.sh /server-ltx.sh
|
||||
ADD server-ltt.sh /server-ltt.sh
|
||||
ADD server-lttw.sh /server-lttw.sh
|
||||
ADD server-ltpw.sh /server-ltpw.sh
|
||||
ADD server-mtt.sh /server-mtt.sh
|
||||
ADD server-mttw.sh /server-mttw.sh
|
||||
ADD server-mtpw.sh /server-mtpw.sh
|
||||
ADD server-ttt.sh /server-ttt.sh
|
||||
ADD server-tttw.sh /server-tttw.sh
|
||||
ADD server-ttpw.sh /server-ttpw.sh
|
||||
ADD server-lttg.sh /server-lttg.sh
|
||||
ADD server-ltpg.sh /server-ltpg.sh
|
||||
ADD server-nginx.sh /server-nginx.sh
|
||||
|
||||
RUN chmod 755 /*.sh
|
||||
|
||||
ENTRYPOINT ["/run.sh"]
|
||||
@@ -1,43 +0,0 @@
|
||||
FROM arm64v8/golang:1.19-alpine as builder
|
||||
|
||||
ARG XRAYVER='v1.7.2'
|
||||
|
||||
RUN apk add --no-cache bash git build-base
|
||||
|
||||
WORKDIR /go/src/XTLS/Xray-core
|
||||
RUN git clone https://github.com/XTLS/Xray-core.git . && \
|
||||
git checkout ${XRAYVER} && \
|
||||
go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
|
||||
|
||||
FROM arm64v8/alpine:3.17
|
||||
|
||||
ARG ACMEVER='2.9.0'
|
||||
|
||||
COPY --from=builder /go/src/XTLS/Xray-core/xray /usr/local/bin/
|
||||
|
||||
RUN apk update && apk add bash nginx openssl curl socat jq moreutils
|
||||
RUN cd /root; curl -sSL "https://github.com/acmesh-official/acme.sh/archive/refs/tags/${ACMEVER}.tar.gz"|tar zxvf -
|
||||
RUN cd /root; mv acme.sh-${ACMEVER} .acme.sh
|
||||
|
||||
COPY site-ssl.conf.tpl /etc/nginx/http.d/
|
||||
COPY grpc.tpl /etc/nginx/http.d/
|
||||
COPY ws.tpl /etc/nginx/http.d/
|
||||
ADD run.sh /run.sh
|
||||
ADD server-ltx.sh /server-ltx.sh
|
||||
ADD server-ltt.sh /server-ltt.sh
|
||||
ADD server-lttw.sh /server-lttw.sh
|
||||
ADD server-ltpw.sh /server-ltpw.sh
|
||||
ADD server-mtt.sh /server-mtt.sh
|
||||
ADD server-mttw.sh /server-mttw.sh
|
||||
ADD server-mtpw.sh /server-mtpw.sh
|
||||
ADD server-ttt.sh /server-ttt.sh
|
||||
ADD server-tttw.sh /server-tttw.sh
|
||||
ADD server-ttpw.sh /server-ttpw.sh
|
||||
ADD server-lttg.sh /server-lttg.sh
|
||||
ADD server-ltpg.sh /server-ltpg.sh
|
||||
ADD server-nginx.sh /server-nginx.sh
|
||||
|
||||
RUN chmod 755 /*.sh
|
||||
|
||||
ENTRYPOINT ["/run.sh"]
|
||||
22
README.md
22
README.md
@@ -285,31 +285,19 @@ $ docker run --rm -p 80:80 -p 443:443 samuelhbne/server-xray \
|
||||
```shell
|
||||
$ git clone https://github.com/samuelhbne/server-xray.git
|
||||
$ cd server-xray
|
||||
$ docker build -t samuelhbne/server-xray -f Dockerfile.amd64 .
|
||||
$ docker build -t samuelhbne/server-xray .
|
||||
...
|
||||
```
|
||||
|
||||
### NOTE 5
|
||||
|
||||
Please replace "amd64" with the arch match the current box accordingly. Other supported platforms:
|
||||
|
||||
- "arm64" for arm64v8 platforms. Support AWS A1, t4g instances as well as Apple M1, Raspberry Pi4 with 64bits OS like [Ubuntu arm64](https://ubuntu.com/download/raspberry-pi) or [Debian](https://raspi.debian.net/tested-images/).
|
||||
- "arm" for arm32v7 platforms. Support most Raspberry-Pi releases (Pi2, Pi3, Pi4) with 32bits OS like [Ubuntu armhf](https://ubuntu.com/download/raspberry-pi), [Debian](https://raspi.debian.net/tested-images/) or [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/).
|
||||
|
||||
### NOTE 6
|
||||
|
||||
- arm32v6 (Pi1 and Pi-zero) users should build the docker images from source rather than run it directly, due to the known issue from upstream Alpine image. WIP.
|
||||
- arm32v5 platforms are not supported yet.
|
||||
|
||||
### Cross-compile docker image for the platforms with different architecture
|
||||
|
||||
Please refer the [official doc](https://github.com/docker/buildx) for docker-buildx installation
|
||||
|
||||
```shell
|
||||
docker buildx build --platform=linux/arm/v7 -t samuelhbne/server-xray:armv7 -f Dockerfile.arm .
|
||||
docker buildx build --platform=linux/arm/v6 -t samuelhbne/server-xray:armv6 -f Dockerfile.arm .
|
||||
docker buildx build --platform=linux/arm64 -t samuelhbne/server-xray:arm64 -f Dockerfile.arm64 .
|
||||
docker buildx build --platform=linux/amd64 -t samuelhbne/server-xray:amd64 -f Dockerfile.amd64 .
|
||||
docker buildx build --platform=linux/arm/v7 -t samuelhbne/server-xray:armv7 .
|
||||
docker buildx build --platform=linux/arm/v6 -t samuelhbne/server-xray:armv6 .
|
||||
docker buildx build --platform=linux/arm64 -t samuelhbne/server-xray:arm64 .
|
||||
docker buildx build --platform=linux/amd64 -t samuelhbne/server-xray:amd64 .
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Reference in New Issue
Block a user