Dockerfile.release 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. FROM golang:1.9-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.7.0
  23. # gpg: key 0F386284C03A1162: public key "Philip Estes <[email protected]>" imported
  24. ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162
  25. RUN set -euxo pipefail; \
  26. \
  27. export GNUPGHOME="$(mktemp -d)"; \
  28. gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$MANIFEST_TOOL_GPG_KEY"; \
  29. \
  30. mkdir -p bin; \
  31. \
  32. for bashbrewArch in $BASHBREW_ARCHES; do \
  33. ( \
  34. goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
  35. srcBin="manifest-tool-$GOOS-$GOARCH"; \
  36. if [ "$GOARCH" = 'arm' ]; then [ -n "$GOARM" ]; srcBin="${srcBin}v$GOARM"; fi; \
  37. [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
  38. srcBin="$srcBin$ext"; \
  39. targetBin="bin/manifest-tool-$bashbrewArch$ext"; \
  40. wget -O "$targetBin.asc" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin.asc"; \
  41. wget -O "$targetBin" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin"; \
  42. gpg --batch --verify "$targetBin.asc" "$targetBin"; \
  43. ls -lAFh "$targetBin"*; \
  44. file "$targetBin"*; \
  45. ) \
  46. done; \
  47. \
  48. gpgconf --kill all; \
  49. rm -r "$GNUPGHOME"; \
  50. \
  51. ls -lAFh bin/manifest-tool-*; \
  52. file bin/manifest-tool-*
  53. COPY go .
  54. RUN set -euxo pipefail; \
  55. \
  56. mkdir -p bin; \
  57. \
  58. for bashbrewArch in $BASHBREW_ARCHES; do \
  59. ( \
  60. goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
  61. [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
  62. \
  63. targetBin="bin/bashbrew-$bashbrewArch$ext"; \
  64. go build \
  65. -a -v \
  66. -ldflags '-s -w' \
  67. -tags netgo -installsuffix netgo \
  68. -o "$targetBin" \
  69. ./src/bashbrew \
  70. ; \
  71. ls -lAFh "$targetBin"; \
  72. file "$targetBin"; \
  73. ) \
  74. done; \
  75. \
  76. ls -lAFh bin/bashbrew-*; \
  77. file bin/bashbrew-*