From 8526bb1ed16c7ef124beeb35591c6551599d7260 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Thu, 30 May 2024 16:08:03 +0200 Subject: [PATCH] new node image variant + build that one from current node-kafka --- .github/workflows/images.yaml | 161 ++---------------- node-kafka-watch/Dockerfile | 19 +++ .../main-wait.js | 0 test.sh | 1 + 4 files changed, 31 insertions(+), 150 deletions(-) create mode 100644 node-kafka-watch/Dockerfile rename {node-watchexec => node-kafka-watch}/main-wait.js (100%) diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index a485f0a..f0ec948 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -49,174 +49,35 @@ jobs: ### build steps below are generated ### - - name: Build and push headless-chrome latest + name: Build and push node-kafka-watch root uses: docker/build-push-action@v5 env: SOURCE_DATE_EPOCH: 0 with: - context: headless-chrome + context: node-kafka-watch tags: | - ghcr.io/yolean/headless-chrome:latest - ghcr.io/yolean/headless-chrome:${{ github.sha }} - platforms: linux/amd64 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - build-contexts: | - yolean/docker-base=docker-image://ghcr.io/yolean/docker-base - - - name: Build and push git-http-readonly latest - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: git-http-readonly - tags: | - ghcr.io/yolean/git-http-readonly:latest - ghcr.io/yolean/git-http-readonly:${{ github.sha }} - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build and push runtime-quarkus latest - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: runtime-quarkus - tags: | - ghcr.io/yolean/runtime-quarkus:latest - ghcr.io/yolean/runtime-quarkus:${{ github.sha }} - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build and push java root - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: java - tags: | - ghcr.io/yolean/java:root - ghcr.io/yolean/java:${{ github.sha }}-root - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Build and push java latest - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: to-nonroot/java - tags: | - ghcr.io/yolean/java:latest - ghcr.io/yolean/java:${{ github.sha }} - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - build-contexts: | - yolean/java:root=docker-image://ghcr.io/yolean/java:root - - - name: Build and push runtime-quarkus-ubuntu root - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: runtime-quarkus-ubuntu - tags: | - ghcr.io/yolean/runtime-quarkus-ubuntu:root - ghcr.io/yolean/runtime-quarkus-ubuntu:${{ github.sha }}-root - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - build-contexts: | - yolean/docker-base=docker-image://ghcr.io/yolean/docker-base - - - name: Build and push runtime-quarkus-ubuntu latest - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: to-nonroot/runtime-quarkus-ubuntu - tags: | - ghcr.io/yolean/runtime-quarkus-ubuntu:latest - ghcr.io/yolean/runtime-quarkus-ubuntu:${{ github.sha }} - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - build-contexts: | - yolean/runtime-quarkus-ubuntu:root=docker-image://ghcr.io/yolean/runtime-quarkus-ubuntu:root - - - name: Build and push runtime-quarkus-ubuntu-jre root - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: runtime-quarkus-ubuntu-jre - tags: | - ghcr.io/yolean/runtime-quarkus-ubuntu-jre:root - ghcr.io/yolean/runtime-quarkus-ubuntu-jre:${{ github.sha }}-root - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - build-contexts: | - yolean/java:root=docker-image://ghcr.io/yolean/java:root - yolean/runtime-quarkus-ubuntu:root=docker-image://ghcr.io/yolean/runtime-quarkus-ubuntu:root - - - name: Build and push runtime-quarkus-ubuntu-jre latest - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: to-nonroot/runtime-quarkus-ubuntu-jre - tags: | - ghcr.io/yolean/runtime-quarkus-ubuntu-jre:latest - ghcr.io/yolean/runtime-quarkus-ubuntu-jre:${{ github.sha }} - platforms: linux/amd64,linux/arm64/v8 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - build-contexts: | - yolean/runtime-quarkus-ubuntu-jre:root=docker-image://ghcr.io/yolean/runtime-quarkus-ubuntu-jre:root - - - name: Build and push runtime-quarkus-dev root - uses: docker/build-push-action@v5 - env: - SOURCE_DATE_EPOCH: 0 - with: - context: runtime-quarkus-dev - tags: | - ghcr.io/yolean/runtime-quarkus-dev:root - ghcr.io/yolean/runtime-quarkus-dev:${{ github.sha }}-root + ghcr.io/yolean/node-kafka-watch:root + ghcr.io/yolean/node-kafka-watch:${{ github.sha }}-root platforms: linux/amd64,linux/arm64/v8 push: true cache-from: type=gha cache-to: type=gha,mode=max build-contexts: | - yolean/builder-quarkus=docker-image://ghcr.io/yolean/builder-quarkus - yolean/runtime-quarkus-ubuntu:root=docker-image://ghcr.io/yolean/runtime-quarkus-ubuntu:root + yolean/node-watchexec:root=docker-image://ghcr.io/yolean/node-watchexec:root + yolean/node-kafka:root=docker-image://ghcr.io/yolean/node-kafka:root - - name: Build and push runtime-quarkus-dev latest + name: Build and push node-kafka-watch latest uses: docker/build-push-action@v5 env: SOURCE_DATE_EPOCH: 0 with: - context: to-nonroot/runtime-quarkus-dev + context: to-nonroot/node-kafka-watch tags: | - ghcr.io/yolean/runtime-quarkus-dev:latest - ghcr.io/yolean/runtime-quarkus-dev:${{ github.sha }} + ghcr.io/yolean/node-kafka-watch:latest + ghcr.io/yolean/node-kafka-watch:${{ github.sha }} platforms: linux/amd64,linux/arm64/v8 push: true cache-from: type=gha cache-to: type=gha,mode=max build-contexts: | - yolean/runtime-quarkus-dev:root=docker-image://ghcr.io/yolean/runtime-quarkus-dev:root + yolean/node-kafka-watch:root=docker-image://ghcr.io/yolean/node-kafka-watch:root diff --git a/node-kafka-watch/Dockerfile b/node-kafka-watch/Dockerfile new file mode 100644 index 0000000..3b682c5 --- /dev/null +++ b/node-kafka-watch/Dockerfile @@ -0,0 +1,19 @@ +FROM --platform=$TARGETPLATFORM yolean/node-watchexec:root as watchexec + +FROM --platform=$TARGETPLATFORM yolean/node-kafka:root + +COPY --from=watchexec --chown=0:0 /usr/local/bin/watchexec /usr/local/bin + +WORKDIR /app + +COPY --from=watchexec --chown=nonroot:nogroup /app/main.js main.js + +ENTRYPOINT [ "/usr/local/bin/watchexec", \ + "--print-events", \ + "--debounce=500", \ + "--shell=none", \ + "--watch=/app", \ + "-r", \ + "--", \ + "/usr/local/bin/node" ] +CMD [ "./main.js" ] diff --git a/node-watchexec/main-wait.js b/node-kafka-watch/main-wait.js similarity index 100% rename from node-watchexec/main-wait.js rename to node-kafka-watch/main-wait.js diff --git a/test.sh b/test.sh index 63dd88b..2e5a946 100755 --- a/test.sh +++ b/test.sh @@ -39,6 +39,7 @@ node node-kafka node-kafka-cache node-watchexec +node-kafka-watch node-gcloud runtime-quarkus-ubuntu runtime-quarkus-ubuntu-jre