Dockerfile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. FROM golang:1.17.8-buster
  2. ENV SCOPE_SKIP_UI_ASSETS true
  3. RUN set -eux; \
  4. export arch_val="$(dpkg --print-architecture)"; \
  5. apt-get update && \
  6. if [ "$arch_val" = "amd64" ]; then \
  7. apt-get install -y libpcap-dev time file shellcheck git gcc-arm-linux-gnueabihf curl build-essential gcc-s390x-linux-gnu; \
  8. else \
  9. apt-get install -y libpcap-dev time file shellcheck git curl build-essential; \
  10. fi && \
  11. rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  12. RUN go get -tags netgo \
  13. github.com/fzipp/gocyclo \
  14. golang.org/x/lint/golint \
  15. github.com/kisielk/errcheck \
  16. github.com/client9/misspell/cmd/misspell && \
  17. rm -rf /go/pkg/ /go/src/
  18. # Only install shfmt on amd64, as the version v1.3.0 isn't supported for ppc64le
  19. # and the later version of shfmt doesn't work with the application well
  20. RUN export arch_val="$(dpkg --print-architecture)"; \
  21. if [ "$arch_val" = "amd64" ]; then \
  22. curl -fsSL -o shfmt https://github.com/mvdan/sh/releases/download/v1.3.0/shfmt_v1.3.0_linux_amd64 && \
  23. chmod +x shfmt && \
  24. mv shfmt /usr/bin; \
  25. fi;
  26. # Install Docker (client only)
  27. ENV DOCKERVERSION=17.09.1-ce
  28. RUN export arch_val="$(dpkg --print-architecture)"; \
  29. if [ "$arch_val" = "arm64" ]; then \
  30. curl -fsSLO https://download.docker.com/linux/static/stable/aarch64/docker-${DOCKERVERSION}.tgz; \
  31. elif [ "$arch_val" = "amd64" ]; then \
  32. curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz; \
  33. elif [ "$arch_val" = "ppc64el" ]; then \
  34. curl -fsSLO https://download.docker.com/linux/static/stable/ppc64le/docker-${DOCKERVERSION}.tgz; \
  35. elif [ "$arch_val" = "s390x" ]; then \
  36. curl -fsSLO https://download.docker.com/linux/static/stable/s390x/docker-${DOCKERVERSION}.tgz; \
  37. else \
  38. echo "No Docker client found for architecture $(arch_val)." && \
  39. exit 1; \
  40. fi; \
  41. tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 -C /usr/local/bin docker/docker && \
  42. rm docker-${DOCKERVERSION}.tgz;
  43. COPY build.sh /
  44. ENTRYPOINT ["/build.sh"]
  45. ARG revision
  46. LABEL maintainer="Weaveworks <help@weave.works>" \
  47. org.opencontainers.image.title="backend" \
  48. org.opencontainers.image.source="https://github.com/weaveworks/scope/tree/master/backend" \
  49. org.opencontainers.image.revision="${revision}" \
  50. org.opencontainers.image.vendor="Weaveworks"