Dockerfile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # syntax=docker/dockerfile:1
  2. ###
  3. FROM ubuntu:22.04 AS dind
  4. # https://docs.docker.com/engine/install/ubuntu/
  5. RUN apt-get update && apt-get install -y \
  6. ca-certificates \
  7. curl \
  8. && install -m 0755 -d /etc/apt/keyrings \
  9. && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \
  10. && chmod a+r /etc/apt/keyrings/docker.asc \
  11. && echo \
  12. "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  13. $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
  14. RUN apt-get update && apt-get install -y \
  15. docker-ce \
  16. docker-ce-cli \
  17. containerd.io \
  18. docker-buildx-plugin \
  19. docker-compose-plugin \
  20. && rm -rf /var/lib/apt/lists/* \
  21. && apt-get clean \
  22. && apt-get autoremove -y
  23. ###
  24. FROM dind AS openhands
  25. ENV DEBIAN_FRONTEND=noninteractive
  26. #
  27. RUN apt-get update && apt-get install -y \
  28. bash \
  29. build-essential \
  30. curl \
  31. git \
  32. git-lfs \
  33. software-properties-common \
  34. make \
  35. netcat \
  36. sudo \
  37. wget \
  38. && rm -rf /var/lib/apt/lists/* \
  39. && apt-get clean \
  40. && apt-get autoremove -y
  41. # https://github.com/cli/cli/blob/trunk/docs/install_linux.md
  42. RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
  43. && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
  44. && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
  45. && apt-get update && apt-get -y install \
  46. gh \
  47. && rm -rf /var/lib/apt/lists/* \
  48. && apt-get clean \
  49. && apt-get autoremove -y
  50. # Python 3.12
  51. RUN add-apt-repository ppa:deadsnakes/ppa \
  52. && apt-get update \
  53. && apt-get install -y python3.12 python3.12-venv python3.12-dev python3-pip \
  54. && ln -s /usr/bin/python3.12 /usr/bin/python
  55. # NodeJS >= 18.17.1
  56. RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
  57. && apt-get install -y nodejs
  58. # Poetry >= 1.8
  59. RUN curl -fsSL https://install.python-poetry.org | python3.12 - \
  60. && ln -s ~/.local/bin/poetry /usr/local/bin/poetry
  61. #
  62. RUN <<EOF
  63. #!/bin/bash
  64. printf "#!/bin/bash
  65. set +x
  66. uname -a
  67. docker --version
  68. gh --version | head -n 1
  69. git --version
  70. #
  71. python --version
  72. echo node `node --version`
  73. echo npm `npm --version`
  74. poetry --version
  75. netcat -h 2>&1 | head -n 1
  76. " > /version.sh
  77. chmod a+x /version.sh
  78. EOF
  79. ###
  80. FROM openhands AS dev
  81. RUN apt-get update && apt-get install -y \
  82. dnsutils \
  83. file \
  84. iproute2 \
  85. jq \
  86. lsof \
  87. ripgrep \
  88. silversearcher-ag \
  89. vim \
  90. && rm -rf /var/lib/apt/lists/* \
  91. && apt-get clean \
  92. && apt-get autoremove -y
  93. WORKDIR /app
  94. # cache build dependencies
  95. RUN \
  96. --mount=type=bind,source=./,target=/app/ \
  97. <<EOF
  98. #!/bin/bash
  99. make -s clean
  100. make -s check-dependencies
  101. make -s install-python-dependencies
  102. # NOTE
  103. # node_modules are .dockerignore-d therefore not mountable
  104. # make -s install-frontend-dependencies
  105. EOF
  106. #
  107. CMD ["bash"]