From 6b6549b70a125edb58c64d27480e596d0a31b996 Mon Sep 17 00:00:00 2001 From: Brian Cunnie Date: Sun, 23 Oct 2022 15:15:54 -0700 Subject: [PATCH] Build sslip.io Dockerfiles for both ARM64 & AMD64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...because, hey, I have a Mac, and native is about 10x faster than amd64 emulation. Also because it's cool. I had to compile my own version of Concourse's [`registry-image`](https://github.com/concourse/registry-image-resource) container image because the one shipped with Concourse 7.8.3 is old and doesn't have the multi-platform feature: ``` docker build --build-arg base_image=ubuntu -t cunnie/registry-image -f dockerfiles/ubuntu/Dockerfile ``` Switch Alpine → Fedora to address weird connection issue: ``` > [linux/arm64 3/3] RUN wget https://github.com/cunnie/sslip.io/releases/download/2.6.0/sslip.io-dns-server-linux-arm64 -O /usr/sbin/sslip.io-dns-server; chmod 755 /usr/sbin/sslip.io-dns-server: Connecting to github.com (192.30.255.113:443) wget: error getting response: Connection reset by peer ``` [#21] --- ci/pipeline-sslip.io.yml | 66 ++++++++++++++++++------------ k8s/Dockerfile-delete-me | 8 ++++ k8s/Dockerfile-sslip.io-dns-server | 8 ++-- 3 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 k8s/Dockerfile-delete-me diff --git a/ci/pipeline-sslip.io.yml b/ci/pipeline-sslip.io.yml index 1484fec..aac5333 100644 --- a/ci/pipeline-sslip.io.yml +++ b/ci/pipeline-sslip.io.yml @@ -36,7 +36,7 @@ jobs: DOMAIN: sslip.io - name: build-and-push-sslip.io-dns-server plan: - - get: sslip.io-release + - get: sslip.io trigger: true - task: build-task-image privileged: true @@ -47,20 +47,23 @@ jobs: source: repository: concourse/oci-build-task inputs: - - name: sslip.io-release + - name: sslip.io outputs: - name: image params: - CONTEXT: sslip.io-release/k8s/ - DOCKERFILE: sslip.io-release/k8s/Dockerfile-sslip.io-dns-server + CONTEXT: sslip.io/k8s/ + DOCKERFILE: sslip.io/k8s/Dockerfile-sslip.io-dns-server + IMAGE_PLATFORM: linux/arm64,linux/amd64 + OUTPUT_OCI: true run: path: build - put: sslip.io-dns-server params: - image: image/image.tar + image: image/image + - name: build-and-push-k-v.io-nginx plan: - - get: sslip.io-release + - get: sslip.io trigger: true - task: build-task-image privileged: true @@ -71,20 +74,23 @@ jobs: source: repository: concourse/oci-build-task inputs: - - name: sslip.io-release + - name: sslip.io outputs: - name: image params: - CONTEXT: sslip.io-release/k8s/ - DOCKERFILE: sslip.io-release/k8s/Dockerfile-k-v.io-nginx + CONTEXT: sslip.io/k8s/ + DOCKERFILE: sslip.io/k8s/Dockerfile-k-v.io-nginx + IMAGE_PLATFORM: linux/arm64,linux/amd64 + OUTPUT_OCI: true run: path: build - put: k-v.io-nginx params: - image: image/image.tar + image: image/image + - name: build-and-push-sslip.io-nginx plan: - - get: sslip.io-release + - get: sslip.io trigger: true - task: build-task-image privileged: true @@ -95,32 +101,39 @@ jobs: source: repository: concourse/oci-build-task inputs: - - name: sslip.io-release + - name: sslip.io outputs: - name: image params: - CONTEXT: sslip.io-release/k8s/ - DOCKERFILE: sslip.io-release/k8s/Dockerfile-sslip.io-nginx + CONTEXT: sslip.io/k8s/ + DOCKERFILE: sslip.io/k8s/Dockerfile-sslip.io-nginx + IMAGE_PLATFORM: linux/arm64,linux/amd64 + OUTPUT_OCI: true run: path: build - put: sslip.io-nginx params: - image: image/image.tar + image: image/image + +# Delete this once there's a [Concourse +# release](https://github.com/concourse/concourse/releases) (v7.9 ?) which has +# a new version (> 1.5.1) of the registry-image resource that has the +# multi-platform (ARM & AMD) code. + +# Also, :%s/cunnie-registry-image/registry-image/ +resource_types: +- name: cunnie-registry-image + type: registry-image + source: + repository: cunnie/registry-image resources: -- name: sslip.io - type: git - icon: github - source: - uri: https://github.com/cunnie/sslip.io.git - - name: every-six-hours type: time icon: clock source: {interval: 6h} -# The repo with our sslip.io executable -- name: sslip.io-release +- name: sslip.io type: git icon: github source: @@ -129,7 +142,7 @@ resources: # Where we will push the k-v.io nginx Docker image with HTML assets - name: k-v.io-nginx - type: registry-image + type: cunnie-registry-image icon: docker source: repository: cunnie/k-v.io-nginx @@ -139,7 +152,7 @@ resources: # Where we will push the sslip.io nginx Docker image with HTML assets - name: sslip.io-nginx - type: registry-image + type: cunnie-registry-image icon: docker source: repository: cunnie/sslip.io-nginx @@ -149,10 +162,11 @@ resources: # Where we will push the Docker image with the DNS server - name: sslip.io-dns-server - type: registry-image + type: cunnie-registry-image icon: docker source: repository: cunnie/sslip.io-dns-server username: cunnie password: ((docker_token)) tag: latest + diff --git a/k8s/Dockerfile-delete-me b/k8s/Dockerfile-delete-me new file mode 100644 index 0000000..5af56bd --- /dev/null +++ b/k8s/Dockerfile-delete-me @@ -0,0 +1,8 @@ +# +# cunnie/delete-me +# +# test Dockerfile +# +FROM alpine + +LABEL org.opencontainers.image.authors="Brian Cunnie " diff --git a/k8s/Dockerfile-sslip.io-dns-server b/k8s/Dockerfile-sslip.io-dns-server index f533e57..15fb67a 100644 --- a/k8s/Dockerfile-sslip.io-dns-server +++ b/k8s/Dockerfile-sslip.io-dns-server @@ -19,15 +19,15 @@ # dig +short 127.0.0.1.example.com @localhost -p 3353 # 127.0.0.1 # -FROM alpine AS sslip.io +FROM fedora LABEL org.opencontainers.image.authors="Brian Cunnie " -RUN apk update && apk add bind-tools +RUN dnf install -y bind-utils ARG TARGETARCH # amd64, arm64 (so I can run on AWS graviton2) -RUN wget https://github.com/cunnie/sslip.io/releases/download/2.6.0/sslip.io-dns-server-linux-$TARGETARCH \ - -O /usr/sbin/sslip.io-dns-server; \ +RUN curl https://github.com/cunnie/sslip.io/releases/download/2.6.0/sslip.io-dns-server-linux-$TARGETARCH \ + -o /usr/sbin/sslip.io-dns-server; \ chmod 755 /usr/sbin/sslip.io-dns-server CMD ["/usr/sbin/sslip.io-dns-server"]