Dockerfile.dapper 6.0 KB

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