From d4ab812dc1c72da26a24dd3899ab5c03a546b61d Mon Sep 17 00:00:00 2001 From: evalphobia Date: Mon, 7 Feb 2022 19:33:44 +0900 Subject: [PATCH 1/5] Support arm64 for M1 Mac (Apple Silicon) --- Dockerfile | 53 ++++++++++++++++++++++++++++++++---------------- nginx-proxy.conf | 1 - 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 23b02a6..e8010c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,30 +18,46 @@ MAINTAINER Zach Wily ## Copyright (c) 2015 Node.js contributors ## -# gpg keys listed at https://github.com/nodejs/node -RUN set -ex \ +ENV NODE_VERSION 17.4.0 + +RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + # gpg keys listed at https://github.com/nodejs/node#release-keys + && set -ex \ && for key in \ - 9554F04D7259F04124DE6B476D5A82AC7E37093B \ + 4ED778F539E3634C779C87C6D7062848A1AB005C \ 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ - 0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \ - FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ - DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ - B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ + 108F52B48DB57BB0CC439B2997B01419BD92F80A \ + B9E2F5981AA6E0CD28160D9FF13993A75599653C \ ; do \ - gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ - done - -ENV NPM_CONFIG_LOGLEVEL info -ENV NODE_VERSION 6.4.0 - -RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \ - && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ + done \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ - && grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ - && tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \ - && rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ + # smoke tests + && node --version \ + && npm --version ################################################################################ ## END COPY @@ -61,6 +77,7 @@ RUN apt-get update && \ COPY nginx-proxy.conf /etc/nginx-proxy.conf COPY supervisord.conf /etc/supervisord.conf +RUN ln -s /usr/local/openjdk-8/bin/java /usr/bin/java RUN mkdir -p /var/log/supervisord # Configuration for dynamo-admin to know where to hit dynamo. diff --git a/nginx-proxy.conf b/nginx-proxy.conf index 6345629..5daee10 100644 --- a/nginx-proxy.conf +++ b/nginx-proxy.conf @@ -34,7 +34,6 @@ http { proxy_redirect off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; - proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-NginX-Proxy true; proxy_connect_timeout 60; From dc74b341d8e81e5af741eafa0522b2afdb14a7b6 Mon Sep 17 00:00:00 2001 From: evalphobia Date: Mon, 7 Feb 2022 21:05:17 +0900 Subject: [PATCH 2/5] Add github actions (#1) --- .github/workflows/dockerhub.yaml | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/dockerhub.yaml diff --git a/.github/workflows/dockerhub.yaml b/.github/workflows/dockerhub.yaml new file mode 100644 index 0000000..1590bd8 --- /dev/null +++ b/.github/workflows/dockerhub.yaml @@ -0,0 +1,42 @@ +name: Build and push docker image to dockerhub + +on: + push: + tags: + - v* + workflow_dispatch: + +env: + DOCKERHUB_REPO: evalphobia/dynamo-local-admin-docker + +jobs: + main: + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - name: Set version + id: set_version + shell: bash + run: echo ""::set-output name=VERSION::${{ github.ref_name }}" + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${DOCKERHUB_REPO}:latest + ${DOCKERHUB_REPO}:${{ steps.set_version.outputs.VERSION }} From e9310a16d9805cef68564be1e19db2dfcc91480c Mon Sep 17 00:00:00 2001 From: evalphobia Date: Mon, 7 Feb 2022 21:10:31 +0900 Subject: [PATCH 3/5] fix github actions --- .github/workflows/dockerhub.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerhub.yaml b/.github/workflows/dockerhub.yaml index 1590bd8..87b4914 100644 --- a/.github/workflows/dockerhub.yaml +++ b/.github/workflows/dockerhub.yaml @@ -25,7 +25,7 @@ jobs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} From 3d1f327a7f0f0bd42dc6451c905107a80daecdbf Mon Sep 17 00:00:00 2001 From: evalphobia Date: Tue, 8 Feb 2022 17:11:56 +0900 Subject: [PATCH 4/5] fix github actions --- .github/workflows/dockerhub.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerhub.yaml b/.github/workflows/dockerhub.yaml index 87b4914..cd43144 100644 --- a/.github/workflows/dockerhub.yaml +++ b/.github/workflows/dockerhub.yaml @@ -17,7 +17,7 @@ jobs: - name: Set version id: set_version shell: bash - run: echo ""::set-output name=VERSION::${{ github.ref_name }}" + run: echo "::set-output name=VERSION::${{ github.ref_name }}" - name: Checkout uses: actions/checkout@v2 - name: Set up QEMU From c9753e4a76315cba5292b12fe94eb46a893fcc99 Mon Sep 17 00:00:00 2001 From: evalphobia Date: Tue, 8 Feb 2022 17:19:46 +0900 Subject: [PATCH 5/5] fix github actions --- .github/workflows/dockerhub.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dockerhub.yaml b/.github/workflows/dockerhub.yaml index cd43144..c33797d 100644 --- a/.github/workflows/dockerhub.yaml +++ b/.github/workflows/dockerhub.yaml @@ -38,5 +38,5 @@ jobs: platforms: linux/amd64,linux/arm64 push: true tags: | - ${DOCKERHUB_REPO}:latest - ${DOCKERHUB_REPO}:${{ steps.set_version.outputs.VERSION }} + ${{ env.DOCKERHUB_REPO }}:latest + ${{ env.DOCKERHUB_REPO }}:${{ steps.set_version.outputs.VERSION }}