Dockerfile.release 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. FROM golang:1.8-alpine
  2. RUN apk add --no-cache \
  3. file \
  4. gnupg \
  5. libressl
  6. WORKDIR /usr/src/bashbrew
  7. ENV GOPATH /usr/src/bashbrew:/usr/src/bashbrew/vendor
  8. ENV CGO_ENABLED 0
  9. ENV BASHBREW_ARCHES \
  10. amd64 \
  11. arm32v5 \
  12. arm32v6 \
  13. arm32v7 \
  14. arm64v8 \
  15. darwin-amd64 \
  16. i386 \
  17. ppc64le \
  18. s390x \
  19. windows-amd64
  20. COPY .bashbrew-arch-to-goenv.sh /usr/local/bin/
  21. # https://github.com/estesp/manifest-tool/releases
  22. ENV MANIFEST_TOOL_VERSION 0.6.0
  23. # gpg: key 0F386284C03A1162: public key "Philip Estes <[email protected]>" imported
  24. #ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162
  25. # TODO consume Phil's releases again (once he fixes https://github.com/estesp/manifest-tool/issues/47 properly)
  26. COPY manifest-tool.patch ./
  27. RUN set -euxo pipefail; \
  28. \
  29. mkdir -p bin; \
  30. \
  31. mkdir -p manifest-tool/src/github.com/estesp/manifest-tool; \
  32. wget -qO- "https://github.com/estesp/manifest-tool/archive/v${MANIFEST_TOOL_VERSION}.tar.gz" \
  33. | tar -xz --strip-components=1 -C manifest-tool/src/github.com/estesp/manifest-tool; \
  34. ( cd manifest-tool/src/github.com/estesp/manifest-tool && patch -p1 ) < manifest-tool.patch; \
  35. for bashbrewArch in $BASHBREW_ARCHES; do \
  36. ( \
  37. goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
  38. [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
  39. GOPATH="$PWD/manifest-tool" \
  40. go build \
  41. -a -v \
  42. -ldflags '-s -w' \
  43. # see https://github.com/golang/go/issues/9737#issuecomment-276817652 (and following comments) -- installsuffix is necessary (for now) to keep ARM
  44. # can remove "$bashbrewArch" from "installsuffix" in Go 1.10+ (https://github.com/golang/go/commit/1b53f15ebb00dd158af674df410c7941abb2b933)
  45. -tags netgo -installsuffix "netgo-$bashbrewArch" \
  46. -o "$PWD/bin/manifest-tool-$bashbrewArch$ext" \
  47. github.com/estesp/manifest-tool \
  48. ; \
  49. ls -lAFh "bin/manifest-tool-$bashbrewArch$ext"; \
  50. file "bin/manifest-tool-$bashbrewArch$ext"; \
  51. ) \
  52. done; \
  53. \
  54. ls -l bin; \
  55. file bin/*
  56. COPY go .
  57. RUN set -euxo pipefail; \
  58. \
  59. mkdir -p bin; \
  60. \
  61. for bashbrewArch in $BASHBREW_ARCHES; do \
  62. ( \
  63. goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
  64. [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
  65. \
  66. go build \
  67. -a -v \
  68. -ldflags '-s -w' \
  69. # see https://github.com/golang/go/issues/9737#issuecomment-276817652 (and following comments) -- installsuffix is necessary (for now) to keep ARM
  70. # can remove "$bashbrewArch" from "installsuffix" in Go 1.10+ (https://github.com/golang/go/commit/1b53f15ebb00dd158af674df410c7941abb2b933)
  71. -tags netgo -installsuffix "netgo-$bashbrewArch" \
  72. -o "bin/bashbrew-$bashbrewArch$ext" \
  73. ./src/bashbrew \
  74. ; \
  75. ) \
  76. done; \
  77. \
  78. ls -l bin; \
  79. file bin/*