Dockerfile.amd64 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. FROM ubuntu:rolling
  2. LABEL maintainer="wekan"
  3. # Set the environment variables (defaults where required)
  4. # DOES NOT WORK: paxctl fix for alpine linux: https://github.com/wekan/wekan/issues/1303
  5. # ENV BUILD_DEPS="paxctl"
  6. ENV BUILD_DEPS="apt-utils libarchive-tools gnupg gosu wget curl bzip2 g++ build-essential git ca-certificates python3" \
  7. DEBUG=false \
  8. NODE_VERSION=v12.16.1 \
  9. METEOR_RELEASE=1.10-rc.2 \
  10. USE_EDGE=false \
  11. METEOR_EDGE=1.5-beta.17 \
  12. NPM_VERSION=latest \
  13. FIBERS_VERSION=4.0.1 \
  14. ARCHITECTURE=linux-x64 \
  15. SRC_PATH=./ \
  16. WITH_API=true \
  17. ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE=3 \
  18. ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD=60 \
  19. ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW=15 \
  20. ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE=3 \
  21. ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD=60 \
  22. ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW=15 \
  23. RICHER_CARD_COMMENT_EDITOR=false \
  24. CARD_OPENED_WEBHOOK_ENABLED=false \
  25. ATTACHMENTS_STORE_PATH="" \
  26. MAX_IMAGE_PIXEL="" \
  27. IMAGE_COMPRESS_RATIO="" \
  28. NOTIFICATION_TRAY_AFTER_READ_DAYS_BEFORE_REMOVE="" \
  29. BIGEVENTS_PATTERN=NONE \
  30. NOTIFY_DUE_DAYS_BEFORE_AND_AFTER="" \
  31. NOTIFY_DUE_AT_HOUR_OF_DAY="" \
  32. EMAIL_NOTIFICATION_TIMEOUT=30000 \
  33. MATOMO_ADDRESS="" \
  34. MATOMO_SITE_ID="" \
  35. MATOMO_DO_NOT_TRACK=true \
  36. MATOMO_WITH_USERNAME=false \
  37. BROWSER_POLICY_ENABLED=true \
  38. TRUSTED_URL="" \
  39. WEBHOOKS_ATTRIBUTES="" \
  40. OAUTH2_ENABLED=false \
  41. OAUTH2_LOGIN_STYLE=redirect \
  42. OAUTH2_CLIENT_ID="" \
  43. OAUTH2_SECRET="" \
  44. OAUTH2_SERVER_URL="" \
  45. OAUTH2_AUTH_ENDPOINT="" \
  46. OAUTH2_USERINFO_ENDPOINT="" \
  47. OAUTH2_TOKEN_ENDPOINT="" \
  48. OAUTH2_ID_MAP="" \
  49. OAUTH2_USERNAME_MAP="" \
  50. OAUTH2_FULLNAME_MAP="" \
  51. OAUTH2_ID_TOKEN_WHITELIST_FIELDS="" \
  52. OAUTH2_REQUEST_PERMISSIONS='openid profile email' \
  53. OAUTH2_EMAIL_MAP="" \
  54. LDAP_ENABLE=false \
  55. LDAP_PORT=389 \
  56. LDAP_HOST="" \
  57. LDAP_BASEDN="" \
  58. LDAP_LOGIN_FALLBACK=false \
  59. LDAP_RECONNECT=true \
  60. LDAP_TIMEOUT=10000 \
  61. LDAP_IDLE_TIMEOUT=10000 \
  62. LDAP_CONNECT_TIMEOUT=10000 \
  63. LDAP_AUTHENTIFICATION=false \
  64. LDAP_AUTHENTIFICATION_USERDN="" \
  65. LDAP_AUTHENTIFICATION_PASSWORD="" \
  66. LDAP_LOG_ENABLED=false \
  67. LDAP_BACKGROUND_SYNC=false \
  68. LDAP_BACKGROUND_SYNC_INTERVAL="" \
  69. LDAP_BACKGROUND_SYNC_KEEP_EXISTANT_USERS_UPDATED=false \
  70. LDAP_BACKGROUND_SYNC_IMPORT_NEW_USERS=false \
  71. LDAP_ENCRYPTION=false \
  72. LDAP_CA_CERT="" \
  73. LDAP_REJECT_UNAUTHORIZED=false \
  74. LDAP_USER_AUTHENTICATION=false \
  75. LDAP_USER_AUTHENTICATION_FIELD=uid \
  76. LDAP_USER_SEARCH_FILTER="" \
  77. LDAP_USER_SEARCH_SCOPE="" \
  78. LDAP_USER_SEARCH_FIELD="" \
  79. LDAP_SEARCH_PAGE_SIZE=0 \
  80. LDAP_SEARCH_SIZE_LIMIT=0 \
  81. LDAP_GROUP_FILTER_ENABLE=false \
  82. LDAP_GROUP_FILTER_OBJECTCLASS="" \
  83. LDAP_GROUP_FILTER_GROUP_ID_ATTRIBUTE="" \
  84. LDAP_GROUP_FILTER_GROUP_MEMBER_ATTRIBUTE="" \
  85. LDAP_GROUP_FILTER_GROUP_MEMBER_FORMAT="" \
  86. LDAP_GROUP_FILTER_GROUP_NAME="" \
  87. LDAP_UNIQUE_IDENTIFIER_FIELD="" \
  88. LDAP_UTF8_NAMES_SLUGIFY=true \
  89. LDAP_USERNAME_FIELD="" \
  90. LDAP_FULLNAME_FIELD="" \
  91. LDAP_MERGE_EXISTING_USERS=false \
  92. LDAP_EMAIL_FIELD="" \
  93. LDAP_EMAIL_MATCH_ENABLE=false \
  94. LDAP_EMAIL_MATCH_REQUIRE=false \
  95. LDAP_EMAIL_MATCH_VERIFIED=false \
  96. LDAP_SYNC_USER_DATA=false \
  97. LDAP_SYNC_USER_DATA_FIELDMAP="" \
  98. LDAP_SYNC_GROUP_ROLES="" \
  99. LDAP_DEFAULT_DOMAIN="" \
  100. LDAP_SYNC_ADMIN_STATUS="" \
  101. LDAP_SYNC_ADMIN_GROUPS="" \
  102. HEADER_LOGIN_ID="" \
  103. HEADER_LOGIN_FIRSTNAME="" \
  104. HEADER_LOGIN_LASTNAME="" \
  105. HEADER_LOGIN_EMAIL="" \
  106. LOGOUT_WITH_TIMER=false \
  107. LOGOUT_IN="" \
  108. LOGOUT_ON_HOURS="" \
  109. LOGOUT_ON_MINUTES="" \
  110. CORS="" \
  111. CORS_ALLOW_HEADERS="" \
  112. CORS_EXPOSE_HEADERS="" \
  113. DEFAULT_AUTHENTICATION_METHOD="" \
  114. SCROLLINERTIA="0" \
  115. SCROLLAMOUNT="auto"
  116. # Copy the app to the image
  117. COPY ${SRC_PATH} /home/wekan/app
  118. RUN \
  119. set -o xtrace && \
  120. # Add non-root user wekan
  121. useradd --user-group --system --home-dir /home/wekan wekan && \
  122. \
  123. # OS dependencies
  124. apt-get update -y && apt-get install -y --no-install-recommends ${BUILD_DEPS} && \
  125. #pip3 install -U pip setuptools wheel && \
  126. \
  127. # Meteor installer doesn't work with the default tar binary, so using bsdtar while installing.
  128. # https://github.com/coreos/bugs/issues/1095#issuecomment-350574389
  129. cp $(which tar) $(which tar)~ && \
  130. ln -sf $(which bsdtar) $(which tar) && \
  131. \
  132. # Download nodejs
  133. wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
  134. wget https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc && \
  135. #---------------------------------------------------------------------------------------------
  136. # Node Fibers 100% CPU usage issue:
  137. # https://github.com/wekan/wekan-mongodb/issues/2#issuecomment-381453161
  138. # https://github.com/meteor/meteor/issues/9796#issuecomment-381676326
  139. # https://github.com/sandstorm-io/sandstorm/blob/0f1fec013fe7208ed0fd97eb88b31b77e3c61f42/shell/server/00-startup.js#L99-L129
  140. # Also see beginning of wekan/server/authentication.js
  141. # import Fiber from "fibers";
  142. # Fiber.poolSize = 1e9;
  143. # OLD: Download node version 8.12.0 prerelease that has fix included, => Official 8.12.0 has been released
  144. # Description at https://releases.wekan.team/node.txt
  145. #wget https://releases.wekan.team/node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
  146. #echo "1ed54adb8497ad8967075a0b5d03dd5d0a502be43d4a4d84e5af489c613d7795 node-v8.12.0-linux-x64.tar.gz" >> SHASUMS256.txt.asc && \
  147. \
  148. # Verify nodejs authenticity
  149. grep ${NODE_VERSION}-${ARCHITECTURE}.tar.gz SHASUMS256.txt.asc | shasum -a 256 -c - && \
  150. #export GNUPGHOME="$(mktemp -d)" && \
  151. #\
  152. # Try other key servers if ha.pool.sks-keyservers.net is unreachable
  153. # Code from https://github.com/chorrell/docker-node/commit/2b673e17547c34f17f24553db02beefbac98d23c
  154. # gpg keys listed at https://github.com/nodejs/node#release-team
  155. # and keys listed here from previous version of this Dockerfile
  156. #for key in \
  157. #9554F04D7259F04124DE6B476D5A82AC7E37093B \
  158. #94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
  159. #FD3A5288F042B6850C66B31F09FE44734EB7990E \
  160. #71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
  161. #DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
  162. #C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
  163. #B9AE9905FFD7803F25714661B63B535A4C206CA9 \
  164. #; do \
  165. #gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
  166. #gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
  167. #gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \
  168. #done && \
  169. #gpg --verify SHASUMS256.txt.asc && \
  170. # Ignore socket files then delete files then delete directories
  171. #find "$GNUPGHOME" -type f | xargs rm -f && \
  172. #find "$GNUPGHOME" -type d | xargs rm -fR && \
  173. rm -f SHASUMS256.txt.asc && \
  174. \
  175. # Install Node
  176. tar xvzf node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
  177. rm node-${NODE_VERSION}-${ARCHITECTURE}.tar.gz && \
  178. mv node-${NODE_VERSION}-${ARCHITECTURE} /opt/nodejs && \
  179. ln -s /opt/nodejs/bin/node /usr/bin/node && \
  180. ln -s /opt/nodejs/bin/npm /usr/bin/npm && \
  181. mkdir -p /opt/nodejs/lib/node_modules/fibers/.node-gyp /root/.node-gyp/8.16.1 /home/wekan/.config && \
  182. chown wekan --recursive /home/wekan/.config && \
  183. \
  184. #DOES NOT WORK: paxctl fix for alpine linux: https://github.com/wekan/wekan/issues/1303
  185. #paxctl -mC `which node` && \
  186. \
  187. # Install Node dependencies. Python path for node-gyp.
  188. npm install -g npm@${NPM_VERSION} && \
  189. #npm config set python python2.7 && \
  190. #npm install -g node-gyp && \
  191. #npm install -g fibers@${FIBERS_VERSION} && \
  192. \
  193. # Change user to wekan and install meteor
  194. cd /home/wekan/ && \
  195. chown wekan --recursive /home/wekan && \
  196. #curl "https://install.meteor.com" -o /home/wekan/install_meteor.sh && \
  197. #curl "https://install.meteor.com/?release=${METEOR_RELEASE}" -o /home/wekan/install_meteor.sh && \
  198. # OLD: sed -i "s|RELEASE=.*|RELEASE=${METEOR_RELEASE}\"\"|g" ./install_meteor.sh && \
  199. # Install Meteor forcing its progress
  200. #sed -i 's/VERBOSITY="--silent"/VERBOSITY="--progress-bar"/' ./install_meteor.sh && \
  201. echo "Starting meteor ${METEOR_RELEASE} installation... \n" && \
  202. gosu wekan:wekan curl https://install.meteor.com/ | /bin/sh && \
  203. mv /root/.meteor /home/wekan/ && \
  204. chown wekan --recursive /home/wekan/.meteor && \
  205. \
  206. # Check if opting for a release candidate instead of major release
  207. #if [ "$USE_EDGE" = false ]; then \
  208. #gosu wekan:wekan sh /home/wekan/install_meteor.sh; \
  209. # gosu wekan:wekan curl https://install.meteor.com/ | sh; \
  210. #else \
  211. # gosu wekan:wekan git clone --recursive --depth 1 -b release/METEOR@${METEOR_EDGE} https://github.com/meteor/meteor.git /home/wekan/.meteor; \
  212. #fi; \
  213. #\
  214. # Get additional packages
  215. #mkdir -p /home/wekan/app/packages && \
  216. #chown wekan:wekan --recursive /home/wekan && \
  217. # REPOS BELOW ARE INCLUDED TO WEKAN REPO
  218. #cd /home/wekan/app/packages && \
  219. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/wekan/flow-router.git kadira-flow-router && \
  220. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/meteor-useraccounts/core.git meteor-useraccounts-core && \
  221. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-cas.git && \
  222. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/wekan/wekan-ldap.git && \
  223. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/wekan/wekan-scrollbar.git && \
  224. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/wekan/meteor-accounts-oidc.git && \
  225. #gosu wekan:wekan git clone --depth 1 -b master --recurse-submodules https://github.com/wekan/markdown.git && \
  226. #gosu wekan:wekan mv meteor-accounts-oidc/packages/switch_accounts-oidc wekan-accounts-oidc && \
  227. #gosu wekan:wekan mv meteor-accounts-oidc/packages/switch_oidc wekan-oidc && \
  228. #gosu wekan:wekan rm -rf meteor-accounts-oidc && \
  229. sed -i 's/api\.versionsFrom/\/\/api.versionsFrom/' /home/wekan/app/packages/meteor-useraccounts-core/package.js && \
  230. cd /home/wekan/.meteor && \
  231. gosu wekan:wekan /home/wekan/.meteor/meteor -- help; \
  232. \
  233. # extract the OpenAPI specification
  234. #npm install -g api2html@0.3.3 && \
  235. #mkdir -p /home/wekan/python && \
  236. #chown wekan --recursive /home/wekan/python && \
  237. #cd /home/wekan/python && \
  238. #gosu wekan:wekan git clone --depth 1 -b master https://github.com/Kronuz/esprima-python && \
  239. #cd /home/wekan/python/esprima-python && \
  240. #python3 setup.py install --record files.txt && \
  241. #cd /home/wekan/app && \
  242. #mkdir -p /home/wekan/app/public/api && \
  243. #chown wekan --recursive /home/wekan/app && \
  244. #gosu wekan:wekan python3 ./openapi/generate_openapi.py --release $(git describe --tags --abbrev=0) > ./public/api/wekan.yml && \
  245. #gosu wekan:wekan /opt/nodejs/bin/api2html -c ./public/logo-header.png -o ./public/api/wekan.html ./public/api/wekan.yml; \
  246. # Build app
  247. cd /home/wekan/app && \
  248. mkdir -p /home/wekan/.npm && \
  249. chown wekan --recursive /home/wekan/.npm /home/wekan/.config /home/wekan/.meteor && \
  250. #gosu wekan:wekan /home/wekan/.meteor/meteor add standard-minifier-js && \
  251. gosu wekan:wekan npm install && \
  252. gosu wekan:wekan /home/wekan/.meteor/meteor build --directory /home/wekan/app_build && \
  253. cp /home/wekan/app/fix-download-unicode/cfs_access-point.txt /home/wekan/app_build/bundle/programs/server/packages/cfs_access-point.js && \
  254. #rm /home/wekan/app_build/bundle/programs/server/npm/node_modules/meteor/rajit_bootstrap3-datepicker/lib/bootstrap-datepicker/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs && \
  255. chown wekan /home/wekan/app_build/bundle/programs/server/packages/cfs_access-point.js && \
  256. #Removed binary version of bcrypt because of security vulnerability that is not fixed yet.
  257. #https://github.com/wekan/wekan/commit/4b2010213907c61b0e0482ab55abb06f6a668eac
  258. #https://github.com/wekan/wekan/commit/7eeabf14be3c63fae2226e561ef8a0c1390c8d3c
  259. #cd /home/wekan/app_build/bundle/programs/server/npm/node_modules/meteor/npm-bcrypt && \
  260. #gosu wekan:wekan rm -rf node_modules/bcrypt && \
  261. #gosu wekan:wekan npm install bcrypt && \
  262. #
  263. # Delete phantomjs
  264. #cd /home/wekan/app_build/bundle && \
  265. #find . -name "*phantomjs*" | xargs rm -rf && \
  266. #
  267. cd /home/wekan/app_build/bundle/programs/server/ && \
  268. gosu wekan:wekan npm install && \
  269. #gosu wekan:wekan npm install bcrypt && \
  270. mv /home/wekan/app_build/bundle /build && \
  271. \
  272. # Put back the original tar
  273. mv $(which tar)~ $(which tar) && \
  274. \
  275. # Cleanup
  276. apt-get remove --purge -y ${BUILD_DEPS} && \
  277. apt-get autoremove -y && \
  278. npm uninstall -g api2html &&\
  279. rm -R /var/lib/apt/lists/* && \
  280. rm -R /home/wekan/.meteor && \
  281. rm -R /home/wekan/app && \
  282. rm -R /home/wekan/app_build
  283. #cat /home/wekan/python/esprima-python/files.txt | xargs rm -R && \
  284. #rm -R /home/wekan/python
  285. #rm /home/wekan/install_meteor.sh
  286. ENV PORT=8080
  287. EXPOSE $PORT
  288. USER wekan
  289. CMD ["node", "/build/main.js"]