Skip to content

Commit

Permalink
chore: update docker builder
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Feb 12, 2023
1 parent f98c919 commit 7bf4865
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 24 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 9 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM alpine AS builder

ADD . /ifs
RUN sh /ifs/deploy

########

FROM alpine

LABEL version="v0.6.1" \
maintainer="[email protected]"

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
17 changes: 17 additions & 0 deletions docker/deploy
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions docker/tdp-server
Original file line number Diff line number Diff line change
@@ -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 <<EOF >$yml
server:
dsn: /var/lib/tdp-cloud/server.db
listen: 7800
EOF

exec tdp-cloud server -c $yml

0 comments on commit 7bf4865

Please sign in to comment.