From f3f785dbecd96b756d2d7d2846b2d3df9224a929 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Sun, 26 Jun 2022 12:28:33 +0700
Subject: [PATCH 01/16] leverage cargo target, and docker image build

---
 .github/workflows/Dockerfile.ci               |  84 ++++++
 .../docker-image-rust-target-multi.yml        | 241 ++++++++++++++++++
 Dockerfile                                    |  21 +-
 3 files changed, 336 insertions(+), 10 deletions(-)
 create mode 100644 .github/workflows/Dockerfile.ci
 create mode 100644 .github/workflows/docker-image-rust-target-multi.yml

diff --git a/.github/workflows/Dockerfile.ci b/.github/workflows/Dockerfile.ci
new file mode 100644
index 000000000..7aa620214
--- /dev/null
+++ b/.github/workflows/Dockerfile.ci
@@ -0,0 +1,84 @@
+FROM debian:bullseye AS ffmpeg
+ARG DEBIAN_FRONTEND=noninteractive
+WORKDIR /static
+ARG TARGETPLATFORM
+RUN echo ${TARGETPLATFORM}
+RUN apt update && \
+    apt install -y --no-install-recommends wget unzip tar ca-certificates xz-utils
+
+RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
+    wget https://github.com/Dusk-Labs/ffmpeg-static/releases/download/ffmpeg-all-0.0.1/ffmpeg && \
+    wget https://github.com/Dusk-Labs/ffmpeg-static/releases/download/ffmpeg-all-0.0.1/ffprobe && \
+    ls -la . && \
+    pwd \
+    ; fi
+    
+RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
+    wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz && \
+    tar --strip-components 1 -xf ffmpeg-release-arm64-static.tar.xz \
+    ; fi
+    
+RUN if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
+    wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-armhf-static.tar.xz && \
+    tar --strip-components 1 -xf ffmpeg-release-armhf-static.tar.xz \
+    ; fi
+    
+RUN chmod +x /static/ffmpeg && chmod +x /static/ffprobe
+# Smoke Test
+#RUN /static/ffmpeg -version
+#RUN /static/ffprobe -version
+
+FROM debian:bullseye AS dim
+ARG DEBIAN_FRONTEND=noninteractive
+ARG TARGETPLATFORM
+WORKDIR /dim
+COPY bin/ bin/
+RUN ls -al bin/
+RUN mkdir -p target/
+
+RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
+    mv bin/amd64-bin/dim target/dim && \
+    chmod +x target/dim && \
+    ls -la target/ . && \
+    pwd \
+    ; fi
+    
+RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
+    mv bin/aarch64-bin/dim target/dim && \
+    chmod +x target/dim && \
+    ls -la target/ . && \
+    pwd \
+    ; fi
+    
+RUN if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
+    mv bin/armhf-bin/dim target/dim && \
+    chmod +x target/dim && \
+    ls -la target/ . && \
+    pwd \
+    ; fi
+
+
+FROM debian:bullseye
+ENV RUST_BACKTRACE=full
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y \
+    ca-certificates \
+    libfontconfig \
+    libfribidi0 \
+    libharfbuzz0b \
+    libtheora0 \
+    libva-drm2 \
+    libva2 \
+    libvorbis0a \
+    libvorbisenc2 \
+    && rm -rf /var/lib/apt/lists/*
+COPY --from=ffmpeg /static/ffmpeg /opt/dim/utils/ffmpeg
+COPY --from=ffmpeg /static/ffprobe /opt/dim/utils/ffprobe
+COPY --from=dim /dim/target/dim /opt/dim/dim
+
+EXPOSE 8000
+VOLUME ["/opt/dim/config"]
+
+ENV RUST_LOG=info
+WORKDIR /opt/dim
+CMD ["./dim"]
diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
new file mode 100644
index 000000000..5cb65fda4
--- /dev/null
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -0,0 +1,241 @@
+name: Build Dim Bin and Dockerize
+
+on:
+  push:
+    branches: [ 'docker-build' ]
+
+env:
+  CARGO_TERM_COLOR: always
+  DATABASE_URL: "sqlite://./dim_dev.db"
+  # OpenSSL Tweak
+  
+jobs:
+  create-ui:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v2        
+      - name: Build UI 
+        uses: actions/setup-node@v3
+        with:
+            node-version: '16'
+            cache: 'yarn'
+      - run: npm install -g yarn
+      - run: yarn -d --cwd ui/ install
+      - run: yarn -d --cwd ui/ build
+      - name: upload ui artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: ui
+          path: ui/build
+
+  build-armhf:
+    needs: [create-ui]
+    runs-on: ubuntu-latest
+    container: 
+      image: rustlang/rust:nightly
+      env:
+        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
+        OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
+        OPENSSL_LIB_DIR: "/usr/lib/arm-linux-gnueabihf/"
+        CARGO_TERM_COLOR: always
+        DATABASE_URL: "sqlite://./dim_dev.db"
+    steps:
+      - name: add armhf architecture
+        run: dpkg --add-architecture armhf
+      - name: install runtime
+        run: apt update && apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross libssl-dev:armhf
+      - name: add armhf target
+        run: rustup target add armv7-unknown-linux-gnueabihf
+      - name: set default nightly
+        run: rustup default nightly
+      - name: smoke test
+        run: rustc --version
+      - name: Checkout repository
+        uses: actions/checkout@v2
+      - name: Download webui
+        uses: actions/download-artifact@v3
+        with:
+          name: ui
+          path: ui/build
+      - name: compile armhf
+        run: cargo build --target=armv7-unknown-linux-gnueabihf --release
+      - name: check path
+        run: ls -al target/
+      - name: upload armhf artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: armhf-bin
+          path: target/armv7-unknown-linux-gnueabihf/release/dim
+
+
+  build-aarch64:
+    needs: [create-ui]
+    runs-on: ubuntu-latest
+    container: 
+      image: rustlang/rust:nightly
+      env:
+        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
+        OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
+        OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
+        CARGO_TERM_COLOR: always
+        DATABASE_URL: "sqlite://./dim_dev.db"
+    steps:
+      - name: add arm64 architecture
+        run: dpkg --add-architecture arm64
+      - name: install runtime
+        run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
+      - name: add arm64 target
+        run: rustup target add aarch64-unknown-linux-gnu
+      - name: set default nightly
+        run: rustup default nightly
+      - name: smoke test
+        run: rustc --version
+      - name: Checkout repository
+        uses: actions/checkout@v2
+      - name: Download webui
+        uses: actions/download-artifact@v3
+        with:
+          name: ui
+          path: ui/build
+      - name: compile aarch64
+        run: cargo build --target=aarch64-unknown-linux-gnu --release
+      - name: check path
+        run: ls -al target/
+      - name: upload aarch64 artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: aarch64-bin
+          path: target/aarch64-unknown-linux-gnu/release/dim
+
+#  build-aarch64-musl:
+#    needs: [create-ui]
+#    runs-on: ubuntu-latest
+#    container: 
+#      image: rustlang/rust:stable
+#      env:
+#        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
+#        OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
+#        OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
+#        CARGO_TERM_COLOR: always
+#        DATABASE_URL: "sqlite://./dim_dev.db"
+#    steps:
+#      - name: add arm64 architecture
+#        run: dpkg --add-architecture arm64
+#      - name: install runtime
+#        run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
+#      - name: add arm64 target
+#        run: rustup target add aarch64-unknown-linux-musl
+#      - name: set default nightly
+#        run: rustup default nightly
+#      - name: smoke test
+#        run: rustc --version
+#      - name: Checkout repository
+#        uses: actions/checkout@v2
+#      - name: Download webui
+#        uses: actions/download-artifact@v3
+#        with:
+#          name: ui
+#          path: ui/build
+#      - name: compile aarch64-musl
+#        run: cargo build --target=aarch64-unknown-linux-musl --release
+#      - name: check path
+#        run: ls -al target/
+#      - name: upload aarch64 artifacts
+#        uses: actions/upload-artifact@v3
+#        with:
+#          name: aarch64-bin-musl
+#          path: target/aarch64-unknown-linux-musl/release/dim
+
+    
+  build-amd64:
+    needs: [create-ui]
+    runs-on: ubuntu-latest
+    container: 
+      image: rustlang/rust:nightly
+      env:
+        CARGO_TERM_COLOR: always
+        DATABASE_URL: "sqlite://./dim_dev.db"
+    steps:
+      - name: install runtime
+        run: apt update && apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev libssl-dev libva-dev libva-drm2 libva2
+      - name: set default nightly
+        run: rustup default nightly
+      - name: smoke test
+        run: rustc --version
+      - name: Checkout repository
+        uses: actions/checkout@v2
+      - name: Download webui
+        uses: actions/download-artifact@v3
+        with:
+          name: ui
+          path: ui/build
+      - name: compile amd64
+        run: cargo build --features vaapi --target=x86_64-unknown-linux-gnu --release
+      - name: check path
+        run: ls -al target/
+      - name: upload amd64 artifacts
+        uses: actions/upload-artifact@v3
+        with:
+          name: amd64-bin
+          path: target/x86_64-unknown-linux-gnu/release/dim
+
+  build-docker-image:
+    needs: [build-armhf,build-aarch64,build-amd64]
+    name: Build Docker image
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    steps:
+      - name: fetch repo
+        uses: actions/checkout@v2
+      - name: Download armhf dim artifacts
+        uses: actions/download-artifact@v3
+        with:
+          name: armhf-bin
+          path: bin/armhf-bin
+      - name: Download armhf dim artifacts
+        uses: actions/download-artifact@v3
+        with:
+          name: aarch64-bin
+          path: bin/aarch64-bin
+      - name: Download amd64 dim artifacts
+        uses: actions/download-artifact@v3
+        with:
+          name: amd64-bin
+          path: bin/amd64-bin
+
+      - name: check path
+        run: ls -al
+      - name: check bin path
+        run: ls -al bin/
+
+      - name: setup qemu
+        uses: docker/setup-qemu-action@v1
+      - uses: docker/setup-buildx-action@v2
+      - uses: docker/metadata-action@v3
+        id: meta
+        with:
+          images: ghcr.io/${{ github.repository }}
+          tags: |
+            type=ref,event=branch
+            type=ref,event=pr
+            type=semver,pattern={{version}}
+            type=semver,pattern={{major}}.{{minor}}
+      - uses: docker/login-action@v1
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - uses: docker/build-push-action@v2
+        with:
+          push: true
+          context: .
+          platforms: linux/amd64,linux/arm64,linux/arm/v7
+          file: ./.github/workflows/Dockerfile.ci
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
+          cache-to: type=gha,mode=max
+          cache-from: type=gha
+
diff --git a/Dockerfile b/Dockerfile
index c0ad75c81..5efa0da46 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -9,30 +9,31 @@ RUN yarn run build
 FROM debian:bullseye AS ffmpeg
 ARG DEBIAN_FRONTEND=noninteractive
 WORKDIR /static
+ARG TARGETPLATFORM
+RUN echo ${TARGETPLATFORM}
+RUN apt update && \
+    apt install -y --no-install-recommends wget unzip tar ca-certificates xz-utils
 
-ARG TARGETARCH=amd64
-RUN if [ "$TARGETARCH" = "amd64" ]; then \
-    apt-get update && \
-    apt-get install -y wget unzip && \
+RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
     wget https://github.com/Dusk-Labs/ffmpeg-static/releases/download/ffmpeg-all-0.0.1/ffmpeg && \
     wget https://github.com/Dusk-Labs/ffmpeg-static/releases/download/ffmpeg-all-0.0.1/ffprobe && \
     ls -la . && \
     pwd \
     ; fi
-RUN if [ "$TARGETARCH" = "arm64" ]; then \
-    apt-get update && \
-    apt-get install -y wget tar xz-utils && \
+    
+RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
     wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz && \
     tar --strip-components 1 -xf ffmpeg-release-arm64-static.tar.xz \
     ; fi
-RUN if [ "$TARGETARCH" = "arm" ]; then \
-    apt-get update && \
-    apt-get install -y wget tar xz-utils && \
+    
+RUN if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
     wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-armhf-static.tar.xz && \
     tar --strip-components 1 -xf ffmpeg-release-armhf-static.tar.xz \
     ; fi
+    
 RUN chmod +x /static/ffmpeg && chmod +x /static/ffprobe
 
+
 FROM rust:bullseye AS dim
 ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update && apt-get install -y \

From 015439fce057efd53ac67ecd2a9fec28e46b102d Mon Sep 17 00:00:00 2001
From: Dedy Martadinata Supriyadi <dedyms@hotmail.com>
Date: Tue, 28 Jun 2022 12:49:06 +0700
Subject: [PATCH 02/16] fixing "on:"

---
 .github/workflows/docker-image-rust-target-multi.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 5cb65fda4..1b83f2a26 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -2,7 +2,11 @@ name: Build Dim Bin and Dockerize
 
 on:
   push:
-    branches: [ 'docker-build' ]
+    branches: [ 'develop' ] #rolling build on develop only
+    tags: 'v*' #tag for specific release v1.0.2,or anytag, start with v
+  pull_request:
+    branches: [ 'main' ] #build test on main, not pushing
+  workflow_dispatch:
 
 env:
   CARGO_TERM_COLOR: always

From 545ee335893ac8d38d48aebe1cf35712bfd6d9d9 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Tue, 28 Jun 2022 15:57:11 +0700
Subject: [PATCH 03/16] not pushing on PR

---
 .github/workflows/docker-image-rust-target-multi.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 1b83f2a26..a31052d00 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -2,7 +2,7 @@ name: Build Dim Bin and Dockerize
 
 on:
   push:
-    branches: [ 'develop' ] #rolling build on develop only
+    branches: [ 'master' ] #rolling build on develop only
     tags: 'v*' #tag for specific release v1.0.2,or anytag, start with v
   pull_request:
     branches: [ 'main' ] #build test on main, not pushing
@@ -234,7 +234,8 @@ jobs:
           password: ${{ secrets.GITHUB_TOKEN }}
       - uses: docker/build-push-action@v2
         with:
-          push: true
+          #push: true
+          push: ${{ github.event_name != 'pull_request' }}
           context: .
           platforms: linux/amd64,linux/arm64,linux/arm/v7
           file: ./.github/workflows/Dockerfile.ci

From e96d2978c2d8ec80f957d37156c1dbc7553a0ccf Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Sat, 2 Jul 2022 23:20:21 +0700
Subject: [PATCH 04/16] remove unused, go to stable rust 1.62

---
 .../docker-image-rust-target-multi.yml        | 54 +++----------------
 1 file changed, 6 insertions(+), 48 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index a31052d00..ecd9861ee 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -2,10 +2,10 @@ name: Build Dim Bin and Dockerize
 
 on:
   push:
-    branches: [ 'master' ] #rolling build on develop only
-    tags: 'v*' #tag for specific release v1.0.2,or anytag, start with v
+    branches: [ 'master' ]
+    tags: 'v*' 
   pull_request:
-    branches: [ 'main' ] #build test on main, not pushing
+    branches: [ 'master' ] 
   workflow_dispatch:
 
 env:
@@ -37,7 +37,7 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rustlang/rust:nightly
+      image: rust:1.62
       env:
         CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
@@ -51,8 +51,6 @@ jobs:
         run: apt update && apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross libssl-dev:armhf
       - name: add armhf target
         run: rustup target add armv7-unknown-linux-gnueabihf
-      - name: set default nightly
-        run: rustup default nightly
       - name: smoke test
         run: rustc --version
       - name: Checkout repository
@@ -77,7 +75,7 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rustlang/rust:nightly
+      image: rust:1.62
       env:
         CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
@@ -111,52 +109,12 @@ jobs:
         with:
           name: aarch64-bin
           path: target/aarch64-unknown-linux-gnu/release/dim
-
-#  build-aarch64-musl:
-#    needs: [create-ui]
-#    runs-on: ubuntu-latest
-#    container: 
-#      image: rustlang/rust:stable
-#      env:
-#        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
-#        OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
-#        OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
-#        CARGO_TERM_COLOR: always
-#        DATABASE_URL: "sqlite://./dim_dev.db"
-#    steps:
-#      - name: add arm64 architecture
-#        run: dpkg --add-architecture arm64
-#      - name: install runtime
-#        run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
-#      - name: add arm64 target
-#        run: rustup target add aarch64-unknown-linux-musl
-#      - name: set default nightly
-#        run: rustup default nightly
-#      - name: smoke test
-#        run: rustc --version
-#      - name: Checkout repository
-#        uses: actions/checkout@v2
-#      - name: Download webui
-#        uses: actions/download-artifact@v3
-#        with:
-#          name: ui
-#          path: ui/build
-#      - name: compile aarch64-musl
-#        run: cargo build --target=aarch64-unknown-linux-musl --release
-#      - name: check path
-#        run: ls -al target/
-#      - name: upload aarch64 artifacts
-#        uses: actions/upload-artifact@v3
-#        with:
-#          name: aarch64-bin-musl
-#          path: target/aarch64-unknown-linux-musl/release/dim
-
     
   build-amd64:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rustlang/rust:nightly
+      image: rust:1.62
       env:
         CARGO_TERM_COLOR: always
         DATABASE_URL: "sqlite://./dim_dev.db"

From 9994a498b5f414a4a3c96acbabc753269253d50f Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 00:16:58 +0700
Subject: [PATCH 05/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index ecd9861ee..da37d9568 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -2,7 +2,7 @@ name: Build Dim Bin and Dockerize
 
 on:
   push:
-    branches: [ 'master' ]
+    branches: [ 'master','docker-build' ]
     tags: 'v*' 
   pull_request:
     branches: [ 'master' ] 

From e8307d9346ca5803ea880a8f7a9a315ff6cf2d10 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 00:26:02 +0700
Subject: [PATCH 06/16] add caching cargo deps

---
 .../docker-image-rust-target-multi.yml        | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index da37d9568..387e06cf1 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -60,6 +60,17 @@ jobs:
         with:
           name: ui
           path: ui/build
+      - uses: actions/cache@v3
+        with:
+          path: |
+            .cargo/bin
+            .cargo/registry/index
+            .cargo/registry/cache
+            .cargo/git/db
+            target
+          key: lldap-bin-armhf-${{ hashFiles('**/Cargo.lock') }}
+          restore-keys: |
+            lldap-bin-armhf-
       - name: compile armhf
         run: cargo build --target=armv7-unknown-linux-gnueabihf --release
       - name: check path
@@ -100,6 +111,17 @@ jobs:
         with:
           name: ui
           path: ui/build
+      - uses: actions/cache@v3
+        with:
+          path: |
+            .cargo/bin
+            .cargo/registry/index
+            .cargo/registry/cache
+            .cargo/git/db
+            target
+          key: lldap-bin-aarch64-${{ hashFiles('**/Cargo.lock') }}
+          restore-keys: |
+            lldap-bin-aarch64-
       - name: compile aarch64
         run: cargo build --target=aarch64-unknown-linux-gnu --release
       - name: check path
@@ -132,6 +154,17 @@ jobs:
         with:
           name: ui
           path: ui/build
+      - uses: actions/cache@v3
+        with:
+          path: |
+            .cargo/bin
+            .cargo/registry/index
+            .cargo/registry/cache
+            .cargo/git/db
+            target
+          key: lldap-bin-amd64-${{ hashFiles('**/Cargo.lock') }}
+          restore-keys: |
+            lldap-bin-amd64-
       - name: compile amd64
         run: cargo build --features vaapi --target=x86_64-unknown-linux-gnu --release
       - name: check path

From 17665681a5c4b4af8de0640bb816e627c4165531 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 00:37:34 +0700
Subject: [PATCH 07/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 387e06cf1..c5c9fc2ff 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -37,9 +37,8 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rust:1.62
+      image: rust:1.63
       env:
-        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/arm-linux-gnueabihf/"
         CARGO_TERM_COLOR: always
@@ -48,7 +47,7 @@ jobs:
       - name: add armhf architecture
         run: dpkg --add-architecture armhf
       - name: install runtime
-        run: apt update && apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross libssl-dev:armhf
+        run: apt update && apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross tar ca-certificates
       - name: add armhf target
         run: rustup target add armv7-unknown-linux-gnueabihf
       - name: smoke test
@@ -86,9 +85,8 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rust:1.62
+      image: rust:1.63
       env:
-        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
         CARGO_TERM_COLOR: always

From 929004bfe717bf2f1b9dc19cca0e09594f996916 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 00:37:49 +0700
Subject: [PATCH 08/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index c5c9fc2ff..b4aaedc96 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -134,7 +134,7 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rust:1.62
+      image: rust:1.63
       env:
         CARGO_TERM_COLOR: always
         DATABASE_URL: "sqlite://./dim_dev.db"

From ffe7e11b51bbb4e9a225280506a427d97365cb25 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 00:42:38 +0700
Subject: [PATCH 09/16] remove nightly

---
 .github/workflows/docker-image-rust-target-multi.yml | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index b4aaedc96..f2c550778 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -98,8 +98,6 @@ jobs:
         run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
       - name: add arm64 target
         run: rustup target add aarch64-unknown-linux-gnu
-      - name: set default nightly
-        run: rustup default nightly
       - name: smoke test
         run: rustc --version
       - name: Checkout repository
@@ -141,8 +139,6 @@ jobs:
     steps:
       - name: install runtime
         run: apt update && apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev libssl-dev libva-dev libva-drm2 libva2
-      - name: set default nightly
-        run: rustup default nightly
       - name: smoke test
         run: rustc --version
       - name: Checkout repository

From e7ef2507b9a9aa8e1c6f6d537f0c0f0068e0455b Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 00:57:58 +0700
Subject: [PATCH 10/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index f2c550778..29a9ba283 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -47,7 +47,7 @@ jobs:
       - name: add armhf architecture
         run: dpkg --add-architecture armhf
       - name: install runtime
-        run: apt update && apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross tar ca-certificates
+        run: apt update && apt install -y pkg-config gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross tar ca-certificates
       - name: add armhf target
         run: rustup target add armv7-unknown-linux-gnueabihf
       - name: smoke test

From 1f86d2c24173bff0ff272290ace18d9766abe0a6 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 01:23:25 +0700
Subject: [PATCH 11/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 29a9ba283..58f8fb42c 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -49,7 +49,7 @@ jobs:
       - name: install runtime
         run: apt update && apt install -y pkg-config gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross tar ca-certificates
       - name: add armhf target
-        run: rustup target add armv7-unknown-linux-gnueabihf
+        run: rustup default stable && rustup target add armv7-unknown-linux-gnueabihf
       - name: smoke test
         run: rustc --version
       - name: Checkout repository
@@ -97,7 +97,7 @@ jobs:
       - name: install runtime
         run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
       - name: add arm64 target
-        run: rustup target add aarch64-unknown-linux-gnu
+        run: rustup default stable && rustup target add aarch64-unknown-linux-gnu
       - name: smoke test
         run: rustc --version
       - name: Checkout repository

From 99e2557234701d2aa8ebbce01e4323bee067bd48 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 01:34:24 +0700
Subject: [PATCH 12/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 58f8fb42c..ddc4798e2 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -85,7 +85,7 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rust:1.63
+      image: rust:1.64
       env:
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
@@ -96,10 +96,6 @@ jobs:
         run: dpkg --add-architecture arm64
       - name: install runtime
         run: apt update && apt install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross libssl-dev:arm64
-      - name: add arm64 target
-        run: rustup default stable && rustup target add aarch64-unknown-linux-gnu
-      - name: smoke test
-        run: rustc --version
       - name: Checkout repository
         uses: actions/checkout@v2
       - name: Download webui
@@ -118,6 +114,10 @@ jobs:
           key: lldap-bin-aarch64-${{ hashFiles('**/Cargo.lock') }}
           restore-keys: |
             lldap-bin-aarch64-
+      - name: add arm64 target
+        run: rustup default stable && rustup target add aarch64-unknown-linux-gnu
+      - name: smoke test
+        run: rustc --version            
       - name: compile aarch64
         run: cargo build --target=aarch64-unknown-linux-gnu --release
       - name: check path

From a3cace8b239d30574da2de1f62b6ff9fa860a559 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 01:50:14 +0700
Subject: [PATCH 13/16] Update docker-image-rust-target-multi.yml

---
 .../workflows/docker-image-rust-target-multi.yml   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index ddc4798e2..1a1bae3cb 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -48,10 +48,6 @@ jobs:
         run: dpkg --add-architecture armhf
       - name: install runtime
         run: apt update && apt install -y pkg-config gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross tar ca-certificates
-      - name: add armhf target
-        run: rustup default stable && rustup target add armv7-unknown-linux-gnueabihf
-      - name: smoke test
-        run: rustc --version
       - name: Checkout repository
         uses: actions/checkout@v2
       - name: Download webui
@@ -70,6 +66,10 @@ jobs:
           key: lldap-bin-armhf-${{ hashFiles('**/Cargo.lock') }}
           restore-keys: |
             lldap-bin-armhf-
+      - name: add armhf target
+        run: rustup target add armv7-unknown-linux-gnueabihf
+      - name: smoke test
+        run: rustc --version
       - name: compile armhf
         run: cargo build --target=armv7-unknown-linux-gnueabihf --release
       - name: check path
@@ -115,7 +115,7 @@ jobs:
           restore-keys: |
             lldap-bin-aarch64-
       - name: add arm64 target
-        run: rustup default stable && rustup target add aarch64-unknown-linux-gnu
+        run: rustup target add aarch64-unknown-linux-gnu
       - name: smoke test
         run: rustc --version            
       - name: compile aarch64
@@ -159,6 +159,10 @@ jobs:
           key: lldap-bin-amd64-${{ hashFiles('**/Cargo.lock') }}
           restore-keys: |
             lldap-bin-amd64-
+      - name: add x86_64 target
+        run: rustup target add x64_64-unknown-linux-gnu
+      - name: smoke test
+        run: rustc --version
       - name: compile amd64
         run: cargo build --features vaapi --target=x86_64-unknown-linux-gnu --release
       - name: check path

From 28f941a6a298105075bd130f514b03b4718baa52 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 01:53:36 +0700
Subject: [PATCH 14/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 1a1bae3cb..8f4d6a124 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -10,7 +10,7 @@ on:
 
 env:
   CARGO_TERM_COLOR: always
-  DATABASE_URL: "sqlite://./dim_dev.db"
+  DATABASE_URL: "sqlite://./target/dim_dev.db"
   # OpenSSL Tweak
   
 jobs:
@@ -42,7 +42,6 @@ jobs:
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/arm-linux-gnueabihf/"
         CARGO_TERM_COLOR: always
-        DATABASE_URL: "sqlite://./dim_dev.db"
     steps:
       - name: add armhf architecture
         run: dpkg --add-architecture armhf
@@ -90,7 +89,6 @@ jobs:
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
         CARGO_TERM_COLOR: always
-        DATABASE_URL: "sqlite://./dim_dev.db"
     steps:
       - name: add arm64 architecture
         run: dpkg --add-architecture arm64
@@ -135,7 +133,6 @@ jobs:
       image: rust:1.63
       env:
         CARGO_TERM_COLOR: always
-        DATABASE_URL: "sqlite://./dim_dev.db"
     steps:
       - name: install runtime
         run: apt update && apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev libssl-dev libva-dev libva-drm2 libva2

From 0d35f649881deeac2982e20234d2fddcf5d4fb17 Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 02:01:37 +0700
Subject: [PATCH 15/16] Update docker-image-rust-target-multi.yml

---
 .github/workflows/docker-image-rust-target-multi.yml | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 8f4d6a124..4890190b8 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -84,7 +84,7 @@ jobs:
     needs: [create-ui]
     runs-on: ubuntu-latest
     container: 
-      image: rust:1.64
+      image: rust:1.63
       env:
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
@@ -136,8 +136,6 @@ jobs:
     steps:
       - name: install runtime
         run: apt update && apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev libssl-dev libva-dev libva-drm2 libva2
-      - name: smoke test
-        run: rustc --version
       - name: Checkout repository
         uses: actions/checkout@v2
       - name: Download webui
@@ -157,7 +155,7 @@ jobs:
           restore-keys: |
             lldap-bin-amd64-
       - name: add x86_64 target
-        run: rustup target add x64_64-unknown-linux-gnu
+        run: rustup target add x86_64-unknown-linux-gnu
       - name: smoke test
         run: rustc --version
       - name: compile amd64

From 01fcecc46f61e98dce91fc4b698fdc87efb28b6e Mon Sep 17 00:00:00 2001
From: Dedy Martadinata S <dedyms@pm.me>
Date: Mon, 26 Sep 2022 02:47:59 +0700
Subject: [PATCH 16/16] remove databse url, fix cargo linker

---
 .github/workflows/docker-image-rust-target-multi.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/docker-image-rust-target-multi.yml b/.github/workflows/docker-image-rust-target-multi.yml
index 4890190b8..86c66e55c 100644
--- a/.github/workflows/docker-image-rust-target-multi.yml
+++ b/.github/workflows/docker-image-rust-target-multi.yml
@@ -10,7 +10,6 @@ on:
 
 env:
   CARGO_TERM_COLOR: always
-  DATABASE_URL: "sqlite://./target/dim_dev.db"
   # OpenSSL Tweak
   
 jobs:
@@ -39,6 +38,7 @@ jobs:
     container: 
       image: rust:1.63
       env:
+        CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/arm-linux-gnueabihf/"
         CARGO_TERM_COLOR: always
@@ -86,6 +86,7 @@ jobs:
     container: 
       image: rust:1.63
       env:
+        CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
         OPENSSL_INCLUDE_DIR: "/usr/include/openssl/"
         OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/"
         CARGO_TERM_COLOR: always