From 9419b02cd3b7093c408c5d0ec54cd80cb96ee18e Mon Sep 17 00:00:00 2001 From: naiba Date: Thu, 7 Jul 2022 13:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20fix=20dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dashboard.yml | 14 ++++---------- Dockerfile | 18 ++++++++++-------- script/entrypoint.sh | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/dashboard.yml b/.github/workflows/dashboard.yml index 2659c25..e8ee1bb 100644 --- a/.github/workflows/dashboard.yml +++ b/.github/workflows/dashboard.yml @@ -33,22 +33,16 @@ jobs: dest: dist pkg: cmd/dashboard prefix: dashboard - targets: linux/amd64,linux/arm64,linux/arm-7,linux/386,linux/s390x + targets: linux/amd64,linux/arm64,linux/arm-7,linux/386,linux/s390x,linux/riscv64 v: true x: false race: false ldflags: -s -w buildmode: default - - name: move dist + - name: fix dist run: | - mkdir -p target/linux/{arm,arm64,386,amd64,s390x} - mkdir target/linux/arm/v7/ - mv dist/dashboard-linux-arm-7 target/linux/arm/v7/dashboard - mv dist/dashboard-linux-arm64 target/linux/arm64/dashboard - mv dist/dashboard-linux-386 target/linux/386/dashboard - mv dist/dashboard-linux-amd64 target/linux/amd64/dashboard - mv dist/dashboard-linux-s390x target/linux/s390x/dashboard + cp dist/dashboard-linux-arm-7 dist/dashboard-linux-arm - name: Log in to the GHCR uses: docker/login-action@master @@ -86,7 +80,7 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm64,linux/arm,linux/386,linux/s390x + platforms: linux/amd64,linux/arm64,linux/arm,linux/386,linux/s390x,linux/riscv64 push: true tags: | ${{ steps.image-name.outputs.GHRC_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }} diff --git a/Dockerfile b/Dockerfile index 82effa1..f942930 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,22 @@ -FROM ubuntu:latest +ARG TARGETARCH +ARG TARGETOS + +FROM $TARGETARCH/ubuntu:20.04 -ARG TARGETPLATFORM ENV TZ="Asia/Shanghai" COPY ./script/entrypoint.sh /entrypoint.sh -RUN export DEBIAN_FRONTEND="noninteractive" && - apt update && apt install -y ca-certificates tzdata && - update-ca-certificates && - ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && - dpkg-reconfigure tzdata && +RUN export DEBIAN_FRONTEND="noninteractive" && \ + apt update && apt install -y ca-certificates tzdata && \ + update-ca-certificates && \ + ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \ + dpkg-reconfigure tzdata && \ chmod +x /entrypoint.sh WORKDIR /dashboard COPY ./resource ./resource -COPY target/$TARGETPLATFORM/dashboard ./app +COPY dist/dashboard-$TARGETOS-$TARGETARCH ./app VOLUME ["/dashboard/data"] EXPOSE 80 5555 diff --git a/script/entrypoint.sh b/script/entrypoint.sh index dc39b74..c20950f 100644 --- a/script/entrypoint.sh +++ b/script/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/sh -echo -e "nameserver 127.0.0.11\nnameserver 8.8.8.8\nnameserver 223.5.5.5\n" > /etc/resolv.conf +echo -e "nameserver 127.0.0.11\nnameserver 8.8.4.4\nnameserver 223.5.5.5\n" > /etc/resolv.conf /dashboard/app \ No newline at end of file