Dockerfile.dapper 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. FROM ubuntu:16.04
  2. # FROM arm64=aarch64/ubuntu:16.04 arm=armhf/ubuntu:16.04
  3. RUN apt-get update && \
  4. apt-get install -y --no-install-recommends \
  5. build-essential \
  6. ca-certificates \
  7. cpio \
  8. curl \
  9. dosfstools \
  10. gccgo \
  11. genisoimage \
  12. gettext \
  13. git \
  14. isolinux \
  15. less \
  16. libblkid-dev \
  17. libmount-dev \
  18. libselinux1-dev \
  19. locales \
  20. module-init-tools \
  21. openssh-client \
  22. pkg-config \
  23. qemu \
  24. qemu-kvm \
  25. rsync \
  26. sudo \
  27. syslinux-common \
  28. vim \
  29. wget \
  30. xorriso
  31. ########## Dapper Configuration #####################
  32. ENV DAPPER_ENV VERSION DEV_BUILD RUNTEST
  33. ENV DAPPER_DOCKER_SOCKET true
  34. ENV DAPPER_SOURCE /go/src/github.com/rancher/os
  35. ENV DAPPER_OUTPUT ./bin ./dist ./build/initrd ./build/kernel
  36. ENV DAPPER_RUN_ARGS --privileged
  37. ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
  38. ENV SHELL /bin/bash
  39. WORKDIR ${DAPPER_SOURCE}
  40. ########## General Configuration #####################
  41. ARG DAPPER_HOST_ARCH=amd64
  42. ARG HOST_ARCH=${DAPPER_HOST_ARCH}
  43. ARG ARCH=${HOST_ARCH}
  44. ARG OS_REPO=rancher
  45. ARG HOSTNAME_DEFAULT=rancher
  46. ARG DISTRIB_ID=RancherOS
  47. ARG DOCKER_VERSION=1.11.2
  48. ARG DOCKER_PATCH_VERSION=v${DOCKER_VERSION}-ros1
  49. ARG DOCKER_BUILD_VERSION=1.10.3
  50. ARG DOCKER_BUILD_PATCH_VERSION=v${DOCKER_BUILD_VERSION}-ros1
  51. ARG SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.3/policy.29
  52. ARG KERNEL_VERSION_amd64=4.9.12-rancher
  53. ARG KERNEL_URL_amd64=https://github.com/rancher/os-kernel/releases/download/v${KERNEL_VERSION_amd64}/linux-${KERNEL_VERSION_amd64}-x86.tar.gz
  54. ARG KERNEL_URL_arm64=https://github.com/imikushin/os-kernel/releases/download/Estuary-4.4.0-arm64.8/linux-4.4.0-rancher-arm64.tar.gz
  55. ARG DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz
  56. ARG DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/${DOCKER_PATCH_VERSION}/docker-${DOCKER_VERSION}_arm.tgz
  57. ARG DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/${DOCKER_PATCH_VERSION}/docker-${DOCKER_VERSION}_arm64.tgz
  58. ARG BUILD_DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_BUILD_VERSION}
  59. ARG BUILD_DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/${DOCKER_BUILD_PATCH_VERSION}/docker-${DOCKER_BUILD_VERSION}_arm
  60. ARG BUILD_DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/${DOCKER_BUILD_PATCH_VERSION}/docker-${DOCKER_BUILD_VERSION}_arm64
  61. ARG OS_RELEASES_YML=https://releases.rancher.com/os
  62. ARG OS_SERVICES_REPO=https://raw.githubusercontent.com/${OS_REPO}/os-services
  63. ARG IMAGE_NAME=${OS_REPO}/os
  64. ARG DFS_IMAGE=${OS_REPO}/docker:v${DOCKER_VERSION}-2
  65. ARG OS_BASE_URL_amd64=https://github.com/rancher/os-base/releases/download/v2016.08.1-2/os-base_amd64.tar.xz
  66. ARG OS_BASE_URL_arm64=https://github.com/rancher/os-base/releases/download/v2016.08.1-2/os-base_arm64.tar.xz
  67. ARG OS_BASE_URL_arm=https://github.com/rancher/os-base/releases/download/v2016.08.1-3/os-base_arm.tar.xz
  68. ######################################################
  69. # Set up environment and export all ARGS as ENV
  70. ENV ARCH=${ARCH} \
  71. HOST_ARCH=${HOST_ARCH}
  72. ENV BUILD_DOCKER_URL=BUILD_DOCKER_URL_${ARCH} \
  73. BUILD_DOCKER_URL_amd64=${BUILD_DOCKER_URL_amd64} \
  74. BUILD_DOCKER_URL_arm=${BUILD_DOCKER_URL_arm} \
  75. BUILD_DOCKER_URL_arm64=${BUILD_DOCKER_URL_arm64} \
  76. DAPPER_HOST_ARCH=${DAPPER_HOST_ARCH} \
  77. DFS_IMAGE=${DFS_IMAGE} \
  78. DISTRIB_ID=${DISTRIB_ID} \
  79. DOCKER_PATCH_VERSION=${DOCKER_PATCH_VERSION} \
  80. DOCKER_URL=DOCKER_URL_${ARCH} \
  81. DOCKER_URL_amd64=${DOCKER_URL_amd64} \
  82. DOCKER_URL_arm=${DOCKER_URL_arm} \
  83. DOCKER_URL_arm64=${DOCKER_URL_arm64} \
  84. DOCKER_VERSION=${DOCKER_VERSION} \
  85. DOWNLOADS=/usr/src/downloads \
  86. GOPATH=/go \
  87. GO_VERSION=1.7.1 \
  88. GOARCH=$ARCH \
  89. HOSTNAME_DEFAULT=${HOSTNAME_DEFAULT} \
  90. IMAGE_NAME=${IMAGE_NAME} \
  91. KERNEL_VERSION=${KERNEL_VERSION_amd64} \
  92. KERNEL_URL=KERNEL_URL_${ARCH} \
  93. KERNEL_URL_amd64=${KERNEL_URL_amd64} \
  94. KERNEL_URL_arm64=${KERNEL_URL_arm64} \
  95. OS_BASE_SHA1=OS_BASE_SHA1_${ARCH} \
  96. OS_BASE_URL=OS_BASE_URL_${ARCH} \
  97. OS_BASE_URL_amd64=${OS_BASE_URL_amd64} \
  98. OS_BASE_URL_arm=${OS_BASE_URL_arm} \
  99. OS_BASE_URL_arm64=${OS_BASE_URL_arm64} \
  100. OS_RELEASES_YML=${OS_RELEASES_YML} \
  101. OS_REPO=${OS_REPO} \
  102. OS_SERVICES_REPO=${OS_SERVICES_REPO} \
  103. REPO_VERSION=master \
  104. SELINUX_POLICY_URL=${SELINUX_POLICY_URL}
  105. ENV PATH=${GOPATH}/bin:/usr/local/go/bin:$PATH
  106. RUN mkdir -p ${DOWNLOADS}
  107. # Download kernel
  108. RUN rm /bin/sh && ln -s /bin/bash /bin/sh
  109. RUN echo "... Downloading ${!KERNEL_URL}"; \
  110. if [ -n "${!KERNEL_URL}" ]; then \
  111. curl -fL ${!KERNEL_URL} > ${DOWNLOADS}/kernel.tar.gz \
  112. ;fi
  113. # Download SELinux Policy
  114. RUN curl -pfL ${SELINUX_POLICY_URL} > ${DOWNLOADS}/$(basename ${SELINUX_POLICY_URL})
  115. # Install Go
  116. COPY assets/go-dnsclient.patch ${DAPPER_SOURCE}
  117. RUN ln -sf go-6 /usr/bin/go && \
  118. curl -sfL https://storage.googleapis.com/golang/go${GO_VERSION}.src.tar.gz | tar -xzf - -C /usr/local && \
  119. patch /usr/local/go/src/net/dnsclient_unix.go ${DAPPER_SOURCE}/go-dnsclient.patch && \
  120. cd /usr/local/go/src && \
  121. GOROOT_BOOTSTRAP=/usr GOARCH=${HOST_ARCH} GOHOSTARCH=${HOST_ARCH} ./make.bash && \
  122. rm /usr/bin/go
  123. # Install Host Docker
  124. RUN curl -fL ${!BUILD_DOCKER_URL} > /usr/bin/docker && \
  125. chmod +x /usr/bin/docker
  126. # Install Trash
  127. RUN go get github.com/rancher/trash
  128. # Install golint
  129. RUN go get github.com/golang/lint/golint
  130. RUN go get gopkg.in/check.v1
  131. # Install dapper
  132. RUN curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m | sed 's/arm.*/arm/'` > /usr/bin/dapper && \
  133. chmod +x /usr/bin/dapper
  134. RUN cd ${DOWNLOADS} && \
  135. curl -pfL ${!OS_BASE_URL} | tar xvJf -
  136. ENTRYPOINT ["./scripts/entry"]
  137. CMD ["ci"]