2
0

Dockerfile 14 KB

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