From 823151dc98a82cb6d641e5234bbf970c7074dfcf Mon Sep 17 00:00:00 2001 From: ElevenNotes Date: Thu, 18 Jan 2024 09:28:42 +0100 Subject: [PATCH] fix ? on object --- amd64.dockerfile | 5 +++-- arm64v8.dockerfile | 5 +++-- hooks/post_push | 4 ---- multi-arch-manifest.yaml | 11 ----------- rootfs/labels/main.js | 16 ++++++++-------- 5 files changed, 14 insertions(+), 27 deletions(-) delete mode 100644 hooks/post_push delete mode 100644 multi-arch-manifest.yaml diff --git a/amd64.dockerfile b/amd64.dockerfile index a87e02f..6bb9cdc 100644 --- a/amd64.dockerfile +++ b/amd64.dockerfile @@ -8,7 +8,6 @@ # :: Header FROM 11notes/node:stable - COPY --from=util /util/node/util.js /labels/lib ENV APP_ROOT=/labels # :: Run @@ -16,11 +15,13 @@ # :: prepare image RUN set -ex; \ - mkdir -p ${APP_ROOT}; \ + mkdir -p ${APP_ROOT}/lib; \ apk --no-cache add \ bind-tools; \ apk --no-cache upgrade; + COPY --from=util /util/node/util.js /labels/lib + # :: install RUN set -ex; \ cd ${APP_ROOT}; \ diff --git a/arm64v8.dockerfile b/arm64v8.dockerfile index abab9c5..b0dcf8e 100644 --- a/arm64v8.dockerfile +++ b/arm64v8.dockerfile @@ -13,7 +13,6 @@ # :: Header FROM arm64v8/node:20.10.0-alpine3.19 - COPY --from=util /util/node/util.js /labels/lib COPY --from=qemu qemu-aarch64-static /usr/bin ENV APP_ROOT=/labels @@ -22,11 +21,13 @@ # :: prepare image RUN set -ex; \ - mkdir -p ${APP_ROOT}; \ + mkdir -p ${APP_ROOT}/lib; \ apk --no-cache add \ bind-tools; \ apk --no-cache upgrade; + COPY --from=util /util/node/util.js /labels/lib + # :: install RUN set -ex; \ cd ${APP_ROOT}; \ diff --git a/hooks/post_push b/hooks/post_push deleted file mode 100644 index 2903347..0000000 --- a/hooks/post_push +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64 -chmod +x manifest-tool -./manifest-tool push from-spec multi-arch-manifest.yaml \ No newline at end of file diff --git a/multi-arch-manifest.yaml b/multi-arch-manifest.yaml deleted file mode 100644 index ba8a78d..0000000 --- a/multi-arch-manifest.yaml +++ /dev/null @@ -1,11 +0,0 @@ -image: 11notes/traefik-labels:latest -manifests: - - image: 11notes/traefik-labels:amd64-0.1.8 - platform: - architecture: amd64 - os: linux - - image: 11notes/traefik-labels:arm64v8-0.1.8 - platform: - architecture: arm64 - os: linux - variant: v8 \ No newline at end of file diff --git a/rootfs/labels/main.js b/rootfs/labels/main.js index 8884974..0a1ec6c 100644 --- a/rootfs/labels/main.js +++ b/rootfs/labels/main.js @@ -3,7 +3,7 @@ process.once('SIGINT', () => process.exit(0)); const Docker = require('dockerode'); const redis = require('redis'); -const { nsupdate } = requore('./nsupdate'); +const { nsupdate } = require('./nsupdate'); const { logJSON } = require('/labels/lib/util.js'); const ENV_REDIS_INTERVAL = parseInt(process.env?.LABELS_INTERVAL || 300); @@ -114,30 +114,30 @@ class Labels{ switch(true){ case /traefik\//i.test(label): if(update){ - await this.#redis.set(label, data?.Config?.Labels[label], {EX:ENV_REDIS_INTERVAL + ENV_REDIS_TIMEOUT}); + await this.#redis.set(label, data.Config.Labels[label], {EX:ENV_REDIS_INTERVAL + ENV_REDIS_TIMEOUT}); }else{ await this.#redis.del(label); } - container.labels.traefik[label] = data?.Config?.Labels[label]; + container.labels.traefik[label] = data.Config.Labels[label]; break; case /rfc2136\//i.test(label): - container.labels.rfc2136[label] = data?.Config?.Labels[label]; + container.labels.rfc2136[label] = data.Config.Labels[label]; const type = ((label.match(/rfc2136\/WAN\//i)) ? 'WAN' : 'LAN'); switch(true){ case /rfc2136\/\S+\/server/i.test(label): - rfc2136[type].server = data?.Config?.Labels[label]; + rfc2136[type].server = data.Config.Labels[label]; break; case /rfc2136\/\S+\/key/i.test(label): - rfc2136[type].key = data?.Config?.Labels[label]; + rfc2136[type].key = data.Config.Labels[label]; break; default: if(!update){ - data?.Config?.Labels[label] = data?.Config?.Labels[label].replace(/update add/i, 'update delete'); + data.Config.Labels[label] = data.Config.Labels[label].replace(/update add/i, 'update delete'); } - rfc2136[type].commands.push(data?.Config?.Labels[label]); + rfc2136[type].commands.push(data.Config.Labels[label]); } break; }