containous / traefik-library-image

ARCHIVED
https://github.com/traefik/traefik-library-image
Apache License 2.0
218 stars 60 forks source link

Add image support for various arm archs (v5,6,7) #69

Open chrisbraucker opened 4 years ago

chrisbraucker commented 4 years ago

What does this PR do?

This PR adds native build support for the arch architectures v5, v6, v7 in that it checks versions more fine-grainedly and references official traefik binaries for those versions.

Motivation

It was not possible for me to run the docker build on my Raspberry Pi 3 because apk --print-arch spits out 'armv7', but the bash case operation only allows the generic 'armhf', which in turn results in the backwards-compatible 'armv6' binary. As Traefik actually releases binaries for particular arm architectures, specifically armv7 needed here, I updated the Dockerfile to make local builds possible. This should not interfere with the build-pipeline at all, though I would appreciate the addition of armv7 images.

joerggollnick commented 4 years ago

Is it possible to add your line to tmplv1.Dockerfile and tmplv2.Dockerfile? Thanks?

chrisbraucker commented 4 years ago

Always happy to help. Hope this is complete now :)

klausondrag commented 4 years ago

Thanks chris, this is what I've been looking for. I can confirm it works on my Raspberry Pi 3B+. Any updates on when this will get merged? Will this also result in the images being pushed to docker hub automatically or are more steps needed?

JulioC commented 4 years ago

This also works for me, using Hypriot OS on Raspberry Pi 3B+.

Please note that the current behavior is to fail with an unhelpful message:

Error loading shared library ▒▒▒▒z▒▒▒▒▒o▒▒▒▒▒▒▒▒▒▒▒▒▒^O^▒▒_▒▒▒▒▒#▒▒▒▒▒▒▒▒O▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒߿~o▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒_▒▒▒^▒▒_▒▒▒▒▒: No such file or directory (needed by /entrypoint.sh)

image


If anyone need a quick workaround, I've used this standalone Dockerfile to build a custom image for 2.2.10:

FROM alpine:3.11
RUN apk --no-cache add ca-certificates tzdata
RUN set -ex; \
    apkArch="$(apk --print-arch)"; \
    case "$apkArch" in \
        armhf) arch='armv6' ;; \
        aarch64) arch='arm64' ;; \
        armv[567]) arch="$apkArch" ;; \
        x86_64) arch='amd64' ;; \
        *) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \
    esac; \
    wget --quiet -O /tmp/traefik.tar.gz "https://github.com/containous/traefik/releases/download/v2.2.10/traefik_v2.2.10_linux_$arch.tar.gz"; \
    tar xzvf /tmp/traefik.tar.gz -C /usr/local/bin traefik; \
    rm -f /tmp/traefik.tar.gz; \
    chmod +x /usr/local/bin/traefik
RUN wget --quiet -O /entrypoint.sh "https://raw.githubusercontent.com/containous/traefik-library-image/5920a9c73cb53b985a535a4b8cfbb98dc2f08ad6/alpine/entrypoint.sh"; \
    chmod +x /entrypoint.sh
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["traefik"]

# Metadata
LABEL org.opencontainers.image.vendor="Containous" \
    org.opencontainers.image.url="https://traefik.io" \
    org.opencontainers.image.title="Traefik" \
    org.opencontainers.image.description="A modern reverse-proxy" \
    org.opencontainers.image.version="v2.2.10" \
    org.opencontainers.image.documentation="https://docs.traefik.io"