]> OzVa Git service - ozva-cloud/commitdiff
chore: update docker
authorsigoden <sigoden@gmail.com>
Sun, 7 Apr 2024 23:01:59 +0000 (23:01 +0000)
committersigoden <sigoden@gmail.com>
Sun, 7 Apr 2024 23:01:59 +0000 (23:01 +0000)
.github/workflows/release.yaml
Dockerfile
Dockerfile-release [new file with mode: 0644]

index 788bfecf1d79bb8c6d101721fe31ded31bf5f624..111998e50787753c884600d2331bd7f5b9a576dd 100644 (file)
@@ -177,11 +177,12 @@ jobs:
       - name: Login to DockerHub
         uses: docker/login-action@v2
         with:
-          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          username: ${{ github.repository_owner }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
       - name: Build and push
         uses: docker/build-push-action@v4
         with:
+          file: Dockerfile-release
           build-args: |
             REPO=${{ github.repository }}
             VER=${{ github.ref_name }}
index 94219fbd95eb7540180593652af6ff16ac7c73b4..d27bbb85f2925de30b1c4852ca0a786ee1882a81 100644 (file)
@@ -1,17 +1,12 @@
-FROM alpine as builder
-ARG REPO VER TARGETPLATFORM
-RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ 
-        TARGET="x86_64-unknown-linux-musl"; \
-    elif [  "$TARGETPLATFORM" = "linux/arm64" ]; then \
-        TARGET="aarch64-unknown-linux-musl"; \
-    elif [  "$TARGETPLATFORM" = "linux/386" ]; then \
-        TARGET="i686-unknown-linux-musl"; \
-    elif [  "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
-        TARGET="armv7-unknown-linux-musleabihf"; \
-    fi && \
-    wget https://github.com/${REPO}/releases/download/${VER}/dufs-${VER}-${TARGET}.tar.gz && \
-    tar -xf dufs-${VER}-${TARGET}.tar.gz && \
-    mv dufs /bin/
+FROM --platform=linux/amd64 messense/rust-musl-cross:x86_64-musl AS amd64
+COPY . .
+RUN cargo install --path . --root /
+
+FROM --platform=linux/amd64 messense/rust-musl-cross:aarch64-musl AS arm64
+COPY . .
+RUN cargo install --path . --root /
+
+FROM ${TARGETARCH} AS builder
 
 FROM scratch
 COPY --from=builder /bin/dufs /bin/dufs
diff --git a/Dockerfile-release b/Dockerfile-release
new file mode 100644 (file)
index 0000000..94219fb
--- /dev/null
@@ -0,0 +1,19 @@
+FROM alpine as builder
+ARG REPO VER TARGETPLATFORM
+RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ 
+        TARGET="x86_64-unknown-linux-musl"; \
+    elif [  "$TARGETPLATFORM" = "linux/arm64" ]; then \
+        TARGET="aarch64-unknown-linux-musl"; \
+    elif [  "$TARGETPLATFORM" = "linux/386" ]; then \
+        TARGET="i686-unknown-linux-musl"; \
+    elif [  "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
+        TARGET="armv7-unknown-linux-musleabihf"; \
+    fi && \
+    wget https://github.com/${REPO}/releases/download/${VER}/dufs-${VER}-${TARGET}.tar.gz && \
+    tar -xf dufs-${VER}-${TARGET}.tar.gz && \
+    mv dufs /bin/
+
+FROM scratch
+COPY --from=builder /bin/dufs /bin/dufs
+STOPSIGNAL SIGINT
+ENTRYPOINT ["/bin/dufs"]