Build sslip.io Dockerfiles for both ARM64 & AMD64

...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]
This commit is contained in:
Brian Cunnie
2022-10-23 15:15:54 -07:00
parent 97246b869f
commit 6b6549b70a
3 changed files with 52 additions and 30 deletions

View File

@@ -36,7 +36,7 @@ jobs:
DOMAIN: sslip.io DOMAIN: sslip.io
- name: build-and-push-sslip.io-dns-server - name: build-and-push-sslip.io-dns-server
plan: plan:
- get: sslip.io-release - get: sslip.io
trigger: true trigger: true
- task: build-task-image - task: build-task-image
privileged: true privileged: true
@@ -47,20 +47,23 @@ jobs:
source: source:
repository: concourse/oci-build-task repository: concourse/oci-build-task
inputs: inputs:
- name: sslip.io-release - name: sslip.io
outputs: outputs:
- name: image - name: image
params: params:
CONTEXT: sslip.io-release/k8s/ CONTEXT: sslip.io/k8s/
DOCKERFILE: sslip.io-release/k8s/Dockerfile-sslip.io-dns-server DOCKERFILE: sslip.io/k8s/Dockerfile-sslip.io-dns-server
IMAGE_PLATFORM: linux/arm64,linux/amd64
OUTPUT_OCI: true
run: run:
path: build path: build
- put: sslip.io-dns-server - put: sslip.io-dns-server
params: params:
image: image/image.tar image: image/image
- name: build-and-push-k-v.io-nginx - name: build-and-push-k-v.io-nginx
plan: plan:
- get: sslip.io-release - get: sslip.io
trigger: true trigger: true
- task: build-task-image - task: build-task-image
privileged: true privileged: true
@@ -71,20 +74,23 @@ jobs:
source: source:
repository: concourse/oci-build-task repository: concourse/oci-build-task
inputs: inputs:
- name: sslip.io-release - name: sslip.io
outputs: outputs:
- name: image - name: image
params: params:
CONTEXT: sslip.io-release/k8s/ CONTEXT: sslip.io/k8s/
DOCKERFILE: sslip.io-release/k8s/Dockerfile-k-v.io-nginx DOCKERFILE: sslip.io/k8s/Dockerfile-k-v.io-nginx
IMAGE_PLATFORM: linux/arm64,linux/amd64
OUTPUT_OCI: true
run: run:
path: build path: build
- put: k-v.io-nginx - put: k-v.io-nginx
params: params:
image: image/image.tar image: image/image
- name: build-and-push-sslip.io-nginx - name: build-and-push-sslip.io-nginx
plan: plan:
- get: sslip.io-release - get: sslip.io
trigger: true trigger: true
- task: build-task-image - task: build-task-image
privileged: true privileged: true
@@ -95,32 +101,39 @@ jobs:
source: source:
repository: concourse/oci-build-task repository: concourse/oci-build-task
inputs: inputs:
- name: sslip.io-release - name: sslip.io
outputs: outputs:
- name: image - name: image
params: params:
CONTEXT: sslip.io-release/k8s/ CONTEXT: sslip.io/k8s/
DOCKERFILE: sslip.io-release/k8s/Dockerfile-sslip.io-nginx DOCKERFILE: sslip.io/k8s/Dockerfile-sslip.io-nginx
IMAGE_PLATFORM: linux/arm64,linux/amd64
OUTPUT_OCI: true
run: run:
path: build path: build
- put: sslip.io-nginx - put: sslip.io-nginx
params: 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: resources:
- name: sslip.io
type: git
icon: github
source:
uri: https://github.com/cunnie/sslip.io.git
- name: every-six-hours - name: every-six-hours
type: time type: time
icon: clock icon: clock
source: {interval: 6h} source: {interval: 6h}
# The repo with our sslip.io executable - name: sslip.io
- name: sslip.io-release
type: git type: git
icon: github icon: github
source: source:
@@ -129,7 +142,7 @@ resources:
# Where we will push the k-v.io nginx Docker image with HTML assets # Where we will push the k-v.io nginx Docker image with HTML assets
- name: k-v.io-nginx - name: k-v.io-nginx
type: registry-image type: cunnie-registry-image
icon: docker icon: docker
source: source:
repository: cunnie/k-v.io-nginx repository: cunnie/k-v.io-nginx
@@ -139,7 +152,7 @@ resources:
# Where we will push the sslip.io nginx Docker image with HTML assets # Where we will push the sslip.io nginx Docker image with HTML assets
- name: sslip.io-nginx - name: sslip.io-nginx
type: registry-image type: cunnie-registry-image
icon: docker icon: docker
source: source:
repository: cunnie/sslip.io-nginx repository: cunnie/sslip.io-nginx
@@ -149,10 +162,11 @@ resources:
# Where we will push the Docker image with the DNS server # Where we will push the Docker image with the DNS server
- name: sslip.io-dns-server - name: sslip.io-dns-server
type: registry-image type: cunnie-registry-image
icon: docker icon: docker
source: source:
repository: cunnie/sslip.io-dns-server repository: cunnie/sslip.io-dns-server
username: cunnie username: cunnie
password: ((docker_token)) password: ((docker_token))
tag: latest tag: latest

8
k8s/Dockerfile-delete-me Normal file
View File

@@ -0,0 +1,8 @@
#
# cunnie/delete-me
#
# test Dockerfile
#
FROM alpine
LABEL org.opencontainers.image.authors="Brian Cunnie <brian.cunnie@gmail.com>"

View File

@@ -19,15 +19,15 @@
# dig +short 127.0.0.1.example.com @localhost -p 3353 # dig +short 127.0.0.1.example.com @localhost -p 3353
# 127.0.0.1 # 127.0.0.1
# #
FROM alpine AS sslip.io FROM fedora
LABEL org.opencontainers.image.authors="Brian Cunnie <brian.cunnie@gmail.com>" LABEL org.opencontainers.image.authors="Brian Cunnie <brian.cunnie@gmail.com>"
RUN apk update && apk add bind-tools RUN dnf install -y bind-utils
ARG TARGETARCH # amd64, arm64 (so I can run on AWS graviton2) 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 \ 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; \ -o /usr/sbin/sslip.io-dns-server; \
chmod 755 /usr/sbin/sslip.io-dns-server chmod 755 /usr/sbin/sslip.io-dns-server
CMD ["/usr/sbin/sslip.io-dns-server"] CMD ["/usr/sbin/sslip.io-dns-server"]