Dockerfile.release 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. FROM golang:1.13-alpine3.11
  2. RUN apk add --no-cache \
  3. file \
  4. gnupg
  5. WORKDIR /usr/src/bashbrew
  6. ENV CGO_ENABLED 0
  7. ENV BASHBREW_ARCHES \
  8. amd64 \
  9. arm32v5 \
  10. arm32v6 \
  11. arm32v7 \
  12. arm64v8 \
  13. darwin-amd64 \
  14. i386 \
  15. ppc64le \
  16. s390x \
  17. windows-amd64
  18. COPY .bashbrew-arch-to-goenv.sh /usr/local/bin/
  19. # https://github.com/estesp/manifest-tool/releases
  20. ENV MANIFEST_TOOL_VERSION 1.0.0
  21. # gpg: key 0F386284C03A1162: public key "Philip Estes <[email protected]>" imported
  22. ENV MANIFEST_TOOL_GPG_KEY 27F3EA268A97867EAF0BD05C0F386284C03A1162
  23. RUN set -euxo pipefail; \
  24. \
  25. export GNUPGHOME="$(mktemp -d)"; \
  26. gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$MANIFEST_TOOL_GPG_KEY"; \
  27. \
  28. mkdir -p bin; \
  29. \
  30. for bashbrewArch in $BASHBREW_ARCHES; do \
  31. ( \
  32. goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
  33. srcBin="manifest-tool-$GOOS-$GOARCH"; \
  34. if [ "$GOARCH" = 'arm' ]; then [ -n "$GOARM" ]; srcBin="${srcBin}v$GOARM"; fi; \
  35. [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
  36. srcBin="$srcBin$ext"; \
  37. targetBin="bin/manifest-tool-$bashbrewArch$ext"; \
  38. wget -O "$targetBin.asc" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin.asc"; \
  39. wget -O "$targetBin" "https://github.com/estesp/manifest-tool/releases/download/v${MANIFEST_TOOL_VERSION}/$srcBin"; \
  40. gpg --batch --verify "$targetBin.asc" "$targetBin"; \
  41. ls -lAFh "$targetBin"*; \
  42. file "$targetBin"*; \
  43. ) \
  44. done; \
  45. \
  46. gpgconf --kill all; \
  47. rm -r "$GNUPGHOME"; \
  48. \
  49. ls -lAFh bin/manifest-tool-*; \
  50. file bin/manifest-tool-*
  51. COPY go .
  52. RUN set -euxo pipefail; \
  53. \
  54. mkdir -p bin; \
  55. \
  56. for bashbrewArch in $BASHBREW_ARCHES; do \
  57. ( \
  58. goEnv="$(.bashbrew-arch-to-goenv.sh "$bashbrewArch")"; eval "$goEnv"; \
  59. [ "$GOOS" = 'windows' ] && ext='.exe' || ext=; \
  60. \
  61. targetBin="bin/bashbrew-$bashbrewArch$ext"; \
  62. go build \
  63. -a -v \
  64. -ldflags '-s -w' \
  65. -tags netgo -installsuffix netgo \
  66. -o "$targetBin" \
  67. -mod vendor \
  68. bashbrew/src/bashbrew \
  69. ; \
  70. ls -lAFh "$targetBin"; \
  71. file "$targetBin"; \
  72. ) \
  73. done; \
  74. \
  75. ls -lAFh bin/bashbrew-*; \
  76. file bin/bashbrew-*