diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a962ad74..38b5f093 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,31 +48,19 @@ jobs: ### - - name: Copy tdp-cloud-linux-amd64.gz - run: cp ./build/tdp-cloud-linux-amd64.gz ./docker/tdp-cloud.gz - - - name: Docker build and push for amd64 - uses: docker/build-push-action@v4 - with: - context: ./docker - push: true - tags: rehiy/tdp-cloud:latest - - ### - - name: Setup qemu uses: docker/setup-qemu-action@v2 - name: Setup docker buildx uses: docker/setup-buildx-action@v2 - - name: Copy tdp-cloud-linux-arm64.gz - run: cp ./build/tdp-cloud-linux-arm64.gz ./docker/tdp-cloud.gz + - name: Copy tdp-cloud-linux-*.gz + run: cp ./build/tdp-cloud-linux-*.gz ./docker/ - - name: Docker build and push arm64 + - name: Docker build and push uses: docker/build-push-action@v4 with: context: ./docker push: true - platforms: linux/arm64 - tags: rehiy/tdp-cloud:arm64 + platforms: linux/amd64,linux/arm64 + tags: rehiy/tdp-cloud:latest diff --git a/docker/Dockerfile b/docker/Dockerfile index b2771302..07df0b46 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,15 +1,17 @@ +FROM alpine AS builder + +ADD . /ifs +RUN sh /ifs/deploy + +######## + FROM alpine LABEL version="v0.6.1" \ maintainer="wang@rehiy.com" -ADD tdp-cloud.gz /usr/local/bin/tdp-cloud - -RUN chmod +x /usr/local/bin/tdp-cloud \ - && mkdir -p /var/lib/tdp-cloud \ - && mkdir -p /var/log/tdp-cloud \ - && mkdir -p /etc/tdp-cloud +COPY --from=builder /usr/local/bin/tdp-* /usr/local/bin/ -ENTRYPOINT ["tdp-cloud", "server", "-c", "/etc/tdp-cloud/config.yml"] +ENTRYPOINT ["tdp-server"] EXPOSE 7800 diff --git a/docker/deploy b/docker/deploy new file mode 100644 index 00000000..8dba13c3 --- /dev/null +++ b/docker/deploy @@ -0,0 +1,17 @@ +#!/bin/sh +# + +OS_ARCH="" +case $(uname -m) in + i386) OS_ARCH="386" ;; + i686) OS_ARCH="386" ;; + x86_64) OS_ARCH="amd64" ;; + aarch64) OS_ARCH="arm64" ;; +esac + +gunzip /ifs/tdp-cloud-linux-$OS_ARCH.gz -c >/usr/local/bin/tdp-cloud +cp -a /ifs/tdp-server /usr/local/bin/ + +chmod +x /usr/local/bin/* + +rm -rf /ifs diff --git a/docker/tdp-server b/docker/tdp-server new file mode 100644 index 00000000..880e6855 --- /dev/null +++ b/docker/tdp-server @@ -0,0 +1,16 @@ +#!/bin/sh +# + +mkdir -p /etc/tdp-cloud +mkdir -p /var/lib/tdp-cloud +mkdir -p /var/log/tdp-cloud + +yml=/etc/tdp-cloud/config.yml + +[ -f $yml ] || cat <$yml +server: + dsn: /var/lib/tdp-cloud/server.db + listen: 7800 +EOF + +exec tdp-cloud server -c $yml