SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FROM golang:1.12.6
  2.  
  3. # make Apt non-interactive
  4. RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
  5.   && echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
  6.  
  7. ENV DEBIAN_FRONTEND=noninteractive
  8.  
  9. # Debian Jessie is EOL'd and original repos don't work.
  10. # Switch to the archive mirror until we can get people to
  11. # switch to Stretch.
  12. RUN if grep -q Debian /etc/os-release && grep -q jessie /etc/os-release; then \
  13.     rm /etc/apt/sources.list \
  14.     && echo "deb http://archive.debian.org/debian/ jessie main" >> /etc/apt/sources.list \
  15.     && echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list \
  16.     ; fi
  17.  
  18. # Make sure PATH includes ~/.local/bin
  19. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155
  20. RUN echo 'PATH="$HOME/.local/bin:$PATH"' >> /etc/profile.d/user-local-path.sh
  21.  
  22. # man directory is missing in some base images
  23. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
  24. RUN apt-get update \
  25.   && mkdir -p /usr/share/man/man1 \
  26.   && apt-get install -y \
  27.     git mercurial xvfb apt \
  28.     locales sudo openssh-client ca-certificates tar gzip parallel \
  29.     net-tools netcat unzip zip bzip2 gnupg curl wget make
  30.  
  31.  
  32. # Set timezone to UTC by default
  33. RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
  34.  
  35. # Use unicode
  36. RUN locale-gen C.UTF-8 || true
  37. ENV LANG=C.UTF-8
  38.  
  39. # install jq
  40. ENV JQ_VERSION='1.5'
  41.  
  42. RUN wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/jq-release.key -O /tmp/jq-release.key && \
  43.     wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/v${JQ_VERSION}/jq-linux64.asc -O /tmp/jq-linux64.asc && \
  44.     wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64 && \
  45.     gpg --import /tmp/jq-release.key && \
  46.     gpg --verify /tmp/jq-linux64.asc /tmp/jq-linux64 && \
  47.     cp /tmp/jq-linux64 /usr/bin/jq && \
  48.     chmod +x /usr/bin/jq && \
  49.     rm -f /tmp/jq-release.key && \
  50.     rm -f /tmp/jq-linux64.asc && \
  51.     rm -f /tmp/jq-linux64 \
  52.     jq --version
  53.  
  54. # Install Docker
  55.  
  56. # Docker.com returns the URL of the latest binary when you hit a directory listing
  57. # We curl this URL and `grep` the version out.
  58. # The output looks like this:
  59.  
  60. #>    # To install, run the following commands as root:
  61. #>    curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-17.05.0-ce.tgz && tar --strip-components=1 -xvzf docker-17.05.0-ce.tgz -C /usr/local/bin
  62. #>
  63. #>    # Then start docker in daemon mode:
  64. #>    /usr/local/bin/dockerd
  65.  
  66. RUN set -ex \
  67.   && export DOCKER_VERSION=$(curl --silent --fail --retry 3 https://download.docker.com/linux/static/stable/x86_64/ | grep -o -e 'docker-[.0-9]*\.tgz' | sort -r | head -n 1) \
  68.   && DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \
  69.   && echo Docker URL: $DOCKER_URL \
  70.   && curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
  71.   && ls -lha /tmp/docker.tgz \
  72.   && tar -xz -C /tmp -f /tmp/docker.tgz \
  73.   && mv /tmp/docker/* /usr/bin \
  74.   && rm -rf /tmp/docker /tmp/docker.tgz \
  75.   && which docker \
  76.   && (docker version || true)
  77.  
  78. # docker compose
  79. RUN COMPOSE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/docker-compose-latest" \
  80.   && curl --silent --show-error --location --fail --retry 3 --output /usr/bin/docker-compose $COMPOSE_URL \
  81.   && chmod +x /usr/bin/docker-compose \
  82.   && docker-compose version
  83.  
  84. # install dockerize
  85. RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" \
  86.   && curl --silent --show-error --location --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz $DOCKERIZE_URL \
  87.   && tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz \
  88.   && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
  89.   && dockerize --version
  90.  
  91. RUN groupadd --gid 3434 worker \
  92.   && useradd --uid 3434 --gid worker --shell /bin/bash --create-home worker \
  93.   && echo 'worker ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-worker \
  94.   && echo 'Defaults    env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
  95.  
  96. # BEGIN IMAGE CUSTOMIZATIONS
  97.  
  98. RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=/usr/local/bin sh
  99. RUN curl -sSL https://github.com/gotestyourself/gotestsum/releases/download/v0.3.4/gotestsum_0.3.4_linux_amd64.tar.gz | \
  100.   tar -xz -C /usr/local/bin gotestsum
  101.  
  102. # END IMAGE CUSTOMIZATIONS
  103.  
  104. USER worker
  105.  
  106. CMD ["/bin/sh"]
  107. #
  108. # Install Java 11 LTS / OpenJDK 11
  109. #
  110. RUN if grep -q Debian /etc/os-release && grep -q stretch /etc/os-release; then \
  111.         echo 'deb http://deb.debian.org/debian stretch-backports main' | sudo tee -a /etc/apt/sources.list.d/stretch-backports.list; \
  112.     elif grep -q Ubuntu /etc/os-release && grep -q xenial /etc/os-release; then \
  113.         sudo apt-get update && sudo apt-get install -y software-properties-common && \
  114.         sudo add-apt-repository -y ppa:openjdk-r/ppa; \
  115.     fi && \
  116.     sudo apt-get update && sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless && \
  117.     sudo apt-get install -y bzip2 libgconf-2-4 # for extracting firefox and running chrome, respectively
  118.  
  119. ENV OPENSSL_CONF /
  120.  
  121. ## install phantomjs
  122. #
  123. RUN PHANTOMJS_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/phantomjs-latest.tar.bz2" \
  124.   && sudo apt-get install libfontconfig \
  125.   && curl --silent --show-error --location --fail --retry 3 --output /tmp/phantomjs.tar.bz2 ${PHANTOMJS_URL} \
  126.   && tar -x -C /tmp -f /tmp/phantomjs.tar.bz2 \
  127.   && sudo mv /tmp/phantomjs-*-linux-x86_64/bin/phantomjs /usr/local/bin \
  128.   && rm -rf /tmp/phantomjs.tar.bz2 /tmp/phantomjs-* \
  129.   && phantomjs --version
  130.  
  131. # install firefox
  132.  
  133. # If you are upgrading to any version newer than 47.0.1, you must check the compatibility with
  134. # selenium. See https://github.com/SeleniumHQ/selenium/issues/2559#issuecomment-237079591
  135.  
  136. RUN FIREFOX_URL="https://s3.amazonaws.com/circle-downloads/firefox-mozilla-build_47.0.1-0ubuntu1_amd64.deb" \
  137.   && curl --silent --show-error --location --fail --retry 3 --output /tmp/firefox.deb $FIREFOX_URL \
  138.   && echo 'ef016febe5ec4eaf7d455a34579834bcde7703cb0818c80044f4d148df8473bb  /tmp/firefox.deb' | sha256sum -c \
  139.   && sudo dpkg -i /tmp/firefox.deb || sudo apt-get -f install  \
  140.   && sudo apt-get install -y libgtk3.0-cil-dev libasound2 libasound2 libdbus-glib-1-2 libdbus-1-3 \
  141.   && rm -rf /tmp/firefox.deb \
  142.   && firefox --version
  143.  
  144. # install chrome
  145.  
  146. RUN curl --silent --show-error --location --fail --retry 3 --output /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
  147.     && (sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb || sudo apt-get -fy install)  \
  148.     && rm -rf /tmp/google-chrome-stable_current_amd64.deb \
  149.     && sudo sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
  150.         "/opt/google/chrome/google-chrome" \
  151.     && google-chrome --version
  152.  
  153. RUN CHROME_VERSION="$(google-chrome --version)" \
  154.     && export CHROMEDRIVER_RELEASE="$(echo $CHROME_VERSION | sed 's/^Google Chrome //')" && export CHROMEDRIVER_RELEASE=${CHROMEDRIVER_RELEASE%%.*} \
  155.     && CHROMEDRIVER_VERSION=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROMEDRIVER_RELEASE}) \
  156.     && curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" \
  157.     && cd /tmp \
  158.     && unzip chromedriver_linux64.zip \
  159.     && rm -rf chromedriver_linux64.zip \
  160.     && sudo mv chromedriver /usr/local/bin/chromedriver \
  161.     && sudo chmod +x /usr/local/bin/chromedriver \
  162.     && chromedriver --version
  163.  
  164. # install libgconf-2-4 manually since chrome no longer pulls it in automatically
  165. RUN sudo apt-get install -y libgconf-2-4
  166.  
  167. # start xvfb automatically to avoid needing to express in circle.yml
  168. ENV DISPLAY :99
  169. RUN printf '#!/bin/sh\nXvfb :99 -screen 0 1280x1024x24 &\nexec "$@"\n' > /tmp/entrypoint \
  170.   && chmod +x /tmp/entrypoint \
  171.         && sudo mv /tmp/entrypoint /docker-entrypoint.sh
  172.  
  173. # ensure that the build agent doesn't override the entrypoint
  174. LABEL com.circleci.preserve-entrypoint=true
  175.  
  176. ENTRYPOINT ["/docker-entrypoint.sh"]
  177. CMD ["/bin/sh"]
  178.  
  179. RUN sudo apt-get update
  180. RUN sudo apt-get install build-essential libssl-dev -y
  181. RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | sh
  182. RUN wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
  183.     && sudo dpkg -i /tmp/libpng12.deb \
  184.     && rm /tmp/libpng12.deb
  185.  
  186. USER worker
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top