mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-03-10 12:50:17 +07:00
multi arch support with docker buildx for the arm's race
This commit is contained in:
parent
68bb6ab654
commit
506b4c202f
23
Dockerfile.buildx
Normal file
23
Dockerfile.buildx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
FROM --platform=$TARGETPLATFORM golang:1.13-alpine AS builder
|
||||||
|
LABEL maintainer="joona@kuori.org"
|
||||||
|
|
||||||
|
RUN apk add --update gcc musl-dev git
|
||||||
|
|
||||||
|
ENV GOPATH /tmp/buildcache
|
||||||
|
RUN git clone https://github.com/joohoi/acme-dns /tmp/acme-dns
|
||||||
|
WORKDIR /tmp/acme-dns
|
||||||
|
RUN CGO_ENABLED=1 go build
|
||||||
|
|
||||||
|
FROM --platform=$TARGETPLATFORM alpine:latest
|
||||||
|
|
||||||
|
WORKDIR /root/
|
||||||
|
COPY --from=builder /tmp/acme-dns .
|
||||||
|
RUN mkdir -p /etc/acme-dns
|
||||||
|
RUN mkdir -p /var/lib/acme-dns
|
||||||
|
RUN rm -rf ./config.cfg
|
||||||
|
RUN apk --no-cache add ca-certificates && update-ca-certificates
|
||||||
|
|
||||||
|
VOLUME ["/etc/acme-dns", "/var/lib/acme-dns"]
|
||||||
|
ENTRYPOINT ["./acme-dns"]
|
||||||
|
EXPOSE 53 80 443
|
||||||
|
EXPOSE 53/udp
|
31
docker-buildx.sh
Executable file
31
docker-buildx.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
# Check buildx:
|
||||||
|
# docker buildx ls
|
||||||
|
#
|
||||||
|
# Should have output like:
|
||||||
|
# default default running linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/arm/v7, linux/arm/v6
|
||||||
|
#
|
||||||
|
# If not, to setup buildx (if you are using docker desktop) and buildx command is there:
|
||||||
|
# make sure in: $USER/.docker/config.json
|
||||||
|
# (may not exist), you have: {"experimental": "enabled"}
|
||||||
|
# If you see "buildx command not recognized":
|
||||||
|
# export DOCKER_BUILDKIT=1 && docker build --platform=local -o . git://github.com/docker/buildx && mkdir -p ~/.docker/cli-plugins && mv buildx ~/.docker/cli-plugins/docker-buildx
|
||||||
|
#
|
||||||
|
# But normally let's say you start a brand new digitalocean droplet for builds, and you just do apt install -y docker.io or use the prebuilt docker, I've had to do the following:
|
||||||
|
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && docker buildx rm builder && docker buildx create --name builder --driver docker-container --use && docker buildx inspect --bootstrap
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Usage (assuming you have buildx, docker 18+):
|
||||||
|
# ./docker-buildx vX.X.X
|
||||||
|
|
||||||
|
version=$1
|
||||||
|
platforms="linux/arm64,linux/amd64"
|
||||||
|
|
||||||
|
echo "Building $version of acme-dns for platfroms: $platforms!"
|
||||||
|
|
||||||
|
docker buildx build \
|
||||||
|
--platform $platforms \
|
||||||
|
--rm \
|
||||||
|
--push \
|
||||||
|
--compress \
|
||||||
|
-t joohoi/acme-dns:$version \
|
||||||
|
-f ./Dockerfile.buildx .
|
Loading…
Reference in New Issue
Block a user