Dockerfile 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. FROM golang:1.14.6-alpine3.12 as builder
  2. LABEL maintainer Eugenio Carvalho <eugeniucarvalho@gmail.com>
  3. ARG BUILD_ID
  4. ENV NODE_VERSION 12.13.0
  5. ENV YARN_VERSION 1.19.1
  6. ENV GIT_TERMINAL_PROMPT=1
  7. ENV GONOSUMDB=git.eugeniocarvalho.dev/eugeniucarvalho
  8. ENV GO111MODULE=on
  9. RUN apk --update add git less openssh
  10. RUN addgroup -g 1000 node \
  11. && adduser -u 1000 -G node -s /bin/sh -D node \
  12. && apk add --no-cache \
  13. libstdc++ \
  14. && apk add --no-cache --virtual .build-deps \
  15. curl \
  16. && ARCH= && alpineArch="$(apk --print-arch)" \
  17. && case "${alpineArch##*-}" in \
  18. x86_64) \
  19. ARCH='x64' \
  20. CHECKSUM="f1c73636c4d345c4aefd65cc959f793d7bb795200d43e19e418d7811670b03dd" \
  21. ;; \
  22. *) ;; \
  23. esac \
  24. && if [ -n "${CHECKSUM}" ]; then \
  25. set -eu; \
  26. curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \
  27. echo "$CHECKSUM node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \
  28. && tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
  29. && ln -s /usr/local/bin/node /usr/local/bin/nodejs; \
  30. else \
  31. echo "Building from source" \
  32. # backup build
  33. && apk add --no-cache --virtual .build-deps-full \
  34. binutils-gold \
  35. g++ \
  36. gcc \
  37. gnupg \
  38. libgcc \
  39. linux-headers \
  40. make \
  41. python \
  42. # gpg keys listed at https://github.com/nodejs/node#release-keys
  43. && for key in \
  44. 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
  45. FD3A5288F042B6850C66B31F09FE44734EB7990E \
  46. 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
  47. DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
  48. C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
  49. B9AE9905FFD7803F25714661B63B535A4C206CA9 \
  50. 77984A986EBC2AA786BC0F66B01FBB92821C587A \
  51. 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
  52. 4ED778F539E3634C779C87C6D7062848A1AB005C \
  53. A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
  54. B9E2F5981AA6E0CD28160D9FF13993A75599653C \
  55. ; do \
  56. gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
  57. gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
  58. gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
  59. done \
  60. && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \
  61. && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
  62. && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
  63. && grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
  64. && tar -xf "node-v$NODE_VERSION.tar.xz" \
  65. && cd "node-v$NODE_VERSION" \
  66. && ./configure \
  67. && make -j$(getconf _NPROCESSORS_ONLN) V= \
  68. && make install \
  69. && apk del .build-deps-full \
  70. && cd .. \
  71. && rm -Rf "node-v$NODE_VERSION" \
  72. && rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \
  73. fi \
  74. && rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \
  75. && apk del .build-deps \
  76. && apk add --no-cache --virtual .build-deps-yarn curl gnupg tar \
  77. && for key in \
  78. 6A010C5166006599AA17F08146C2130DFD2497F5 \
  79. ; do \
  80. gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
  81. gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
  82. gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
  83. done \
  84. && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
  85. && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
  86. && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
  87. && mkdir -p /opt \
  88. && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
  89. && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
  90. && ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
  91. && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
  92. && apk del .build-deps-yarn \
  93. && rm -rf /var/lib/apt/lists/* \
  94. && rm /var/cache/apk/*
  95. RUN npm install -g typescript typescript-formatter
  96. COPY eon-amd64 /usr/bin/eon
  97. COPY api /dep/apicodegen/api
  98. COPY authorization /dep/apicodegen/authorization
  99. COPY common /dep/apicodegen/common
  100. COPY go.* /dep/apicodegen/
  101. RUN mkdir /workdir
  102. VOLUME /workdir
  103. WORKDIR /workdir/project