You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.6 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=docker-ce
  3. PKG_VERSION:=19.03.13
  4. PKG_RELEASE:=4
  5. PKG_LICENSE:=Apache-2.0
  6. PKG_LICENSE_FILES:=components/cli/LICENSE components/engine/LICENSE
  7. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  8. PKG_SOURCE_URL:=https://codeload.github.com/docker/docker-ce/tar.gz/v$(PKG_VERSION)?
  9. PKG_HASH:=b2ff08675738031b6d6d59a90226657c16726851957c11b5fb85a4598b933b92
  10. PKG_SOURCE_VERSION:=4484c46d9d # SHA1 used within the docker executables
  11. PKG_MAINTAINER:=Gerard Ryan <G.M0N3Y.2503@gmail.com>
  12. # $(1) = path to dependent package 'Makefile'
  13. # $(2) = relevant docker-ce '.installer' file
  14. define EnsureVendoredVersion
  15. ( \
  16. DEP_VER=$$$$( grep --only-matching --perl-regexp '(?<=PKG_SOURCE_VERSION:=)(.*)' "$(1)" ); \
  17. VEN_VER=$$$$( grep --only-matching --perl-regexp '(?<=_COMMIT:=)(.*)(?=})' "$(PKG_BUILD_DIR)/components/engine/hack/dockerfile/install/$(2)" ); \
  18. if [ $$$$VEN_VER != $$$$DEP_VER ]; then \
  19. echo "ERROR: Expected 'PKG_SOURCE_VERSION:=$$$$VEN_VER' in '$(1)', found 'PKG_SOURCE_VERSION:=$$$$DEP_VER'"; \
  20. exit 1; \
  21. fi \
  22. )
  23. endef
  24. PKG_BUILD_DEPENDS:=golang/host
  25. PKG_BUILD_PARALLEL:=1
  26. GO_PKG:=github.com/docker
  27. include $(INCLUDE_DIR)/package.mk
  28. include ../../lang/golang/golang-package.mk
  29. define Package/docker-ce/config
  30. source "$(SOURCE)/Config.in"
  31. endef
  32. define Package/docker-ce
  33. SECTION:=utils
  34. CATEGORY:=Utilities
  35. TITLE:=Docker Community Edition
  36. URL:=https://www.docker.com/
  37. DEPENDS:=$(GO_ARCH_DEPENDS) @(aarch64||arm||x86_64) +btrfs-progs +ca-certificates +cgroupfs-mount +containerd +libdevmapper +libnetwork +tini \
  38. +DOCKER_SECCOMP:libseccomp +iptables-mod-extra +kmod-br-netfilter +kmod-ikconfig +kmod-nf-conntrack-netlink +kmod-nf-ipvs +kmod-veth
  39. USERID:=docker:docker
  40. MENU:=1
  41. endef
  42. define Package/docker-ce/conffiles
  43. /etc/config/dockerd
  44. endef
  45. define Package/docker-ce/description
  46. Docker Engine is used by millions enables containerized applications
  47. to run anywhere consistently on any infrastructure.
  48. endef
  49. define Build/Prepare
  50. $(Build/Prepare/Default)
  51. # Verify dependencies are the vendored version
  52. $(call EnsureVendoredVersion,../containerd/Makefile,containerd.installer)
  53. $(call EnsureVendoredVersion,../libnetwork/Makefile,proxy.installer)
  54. $(call EnsureVendoredVersion,../runc/Makefile,runc.installer)
  55. $(call EnsureVendoredVersion,../tini/Makefile,tini.installer)
  56. endef
  57. define Build/Configure
  58. # move so GoPackage/Build/Configure will get the correct path
  59. mv $(PKG_BUILD_DIR)/components/engine $(PKG_BUILD_DIR)/
  60. mv $(PKG_BUILD_DIR)/components/cli $(PKG_BUILD_DIR)/
  61. # docker generates files at build time so we'll just symlink for now and call GoPackage/Build/Configure later
  62. mkdir -p $(GO_PKG_BUILD_DIR)/bin \
  63. $(GO_PKG_BUILD_DIR)/src \
  64. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/ \
  65. $(GO_BUILD_CACHE_DIR)
  66. $(LN) $(PKG_BUILD_DIR)/cli $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/cli
  67. $(LN) $(PKG_BUILD_DIR)/engine $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/docker
  68. endef
  69. ifeq ($(CONFIG_DOCKER_SECCOMP),y)
  70. BUILDTAGS:=seccomp
  71. else
  72. BUILDTAGS:=
  73. endif
  74. define Build/Compile
  75. ( \
  76. export $(GO_PKG_VARS) \
  77. GITCOMMIT=$(PKG_SOURCE_VERSION) \
  78. DOCKER_GITCOMMIT=$(PKG_SOURCE_VERSION) \
  79. DOCKER_BUILDTAGS='$(BUILDTAGS)' \
  80. VERSION=$(PKG_VERSION) \
  81. \
  82. && echo "Compiling CLI..." \
  83. && cd $(PKG_BUILD_DIR)/cli \
  84. && ./scripts/build/binary \
  85. \
  86. && echo "Compiling Engine..." \
  87. && cd $(PKG_BUILD_DIR)/engine \
  88. && ./hack/make.sh binary \
  89. )
  90. # done here to include autogenerated files also
  91. rm $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/cli
  92. rm $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/docker
  93. $(call GoPackage/Build/Configure)
  94. endef
  95. define Package/docker-ce/install
  96. $(INSTALL_DIR) $(1)/usr/bin/
  97. $(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/build/docker $(1)/usr/bin/
  98. $(INSTALL_BIN) $(PKG_BUILD_DIR)/engine/bundles/binary-daemon/dockerd $(1)/usr/bin/
  99. $(INSTALL_DIR) $(1)/opt/docker/
  100. $(INSTALL_DIR) $(1)/usr/share/docker/
  101. $(INSTALL_BIN) $(PKG_BUILD_DIR)/engine/contrib/check-config.sh $(1)/usr/share/docker/
  102. $(INSTALL_DIR) $(1)/etc/init.d
  103. $(INSTALL_BIN) ./files/dockerd.init $(1)/etc/init.d/dockerd
  104. $(INSTALL_DIR) $(1)/etc/config
  105. $(INSTALL_CONF) ./files/etc/config/dockerd $(1)/etc/config/dockerd
  106. # Must be after systcl 11-br-netfilter.conf from kmod-br-netfilter
  107. $(INSTALL_DIR) $(1)/etc/sysctl.d
  108. $(INSTALL_DATA) ./files/etc/sysctl.d/sysctl-br-netfilter-ip.conf \
  109. $(1)/etc/sysctl.d/12-br-netfilter-ip.conf
  110. endef
  111. define Package/docker-ce/postinst
  112. #!/bin/sh
  113. [ -n "$$IPKG_INSTROOT" ] || {
  114. /etc/init.d/dockerd enable
  115. /etc/init.d/dockerd uciadd
  116. /etc/init.d/dockerd start
  117. }
  118. endef
  119. define Package/docker-ce/prerm
  120. #!/bin/sh
  121. [ -n "$$IPKG_INSTROOT" ] || {
  122. /etc/init.d/dockerd disable
  123. /etc/init.d/dockerd stop
  124. /etc/init.d/dockerd ucidel
  125. }
  126. endef
  127. $(eval $(call BuildPackage,docker-ce))