Dockerfile.dapper 5.5 KB

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