Dockerfile 4.2 KB

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