Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM golang:1.12.6
- # make Apt non-interactive
- RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \
- && echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci
- ENV DEBIAN_FRONTEND=noninteractive
- # Debian Jessie is EOL'd and original repos don't work.
- # Switch to the archive mirror until we can get people to
- # switch to Stretch.
- RUN if grep -q Debian /etc/os-release && grep -q jessie /etc/os-release; then \
- rm /etc/apt/sources.list \
- && echo "deb http://archive.debian.org/debian/ jessie main" >> /etc/apt/sources.list \
- && echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list \
- ; fi
- # Make sure PATH includes ~/.local/bin
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155
- RUN echo 'PATH="$HOME/.local/bin:$PATH"' >> /etc/profile.d/user-local-path.sh
- # man directory is missing in some base images
- # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
- RUN apt-get update \
- && mkdir -p /usr/share/man/man1 \
- && apt-get install -y \
- git mercurial xvfb apt \
- locales sudo openssh-client ca-certificates tar gzip parallel \
- net-tools netcat unzip zip bzip2 gnupg curl wget make
- # Set timezone to UTC by default
- RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
- # Use unicode
- RUN locale-gen C.UTF-8 || true
- ENV LANG=C.UTF-8
- # install jq
- ENV JQ_VERSION='1.5'
- RUN wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/jq-release.key -O /tmp/jq-release.key && \
- wget --no-check-certificate https://raw.githubusercontent.com/stedolan/jq/master/sig/v${JQ_VERSION}/jq-linux64.asc -O /tmp/jq-linux64.asc && \
- wget --no-check-certificate https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64 -O /tmp/jq-linux64 && \
- gpg --import /tmp/jq-release.key && \
- gpg --verify /tmp/jq-linux64.asc /tmp/jq-linux64 && \
- cp /tmp/jq-linux64 /usr/bin/jq && \
- chmod +x /usr/bin/jq && \
- rm -f /tmp/jq-release.key && \
- rm -f /tmp/jq-linux64.asc && \
- rm -f /tmp/jq-linux64 \
- jq --version
- # Install Docker
- # Docker.com returns the URL of the latest binary when you hit a directory listing
- # We curl this URL and `grep` the version out.
- # The output looks like this:
- #> # To install, run the following commands as root:
- #> 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
- #>
- #> # Then start docker in daemon mode:
- #> /usr/local/bin/dockerd
- RUN set -ex \
- && 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) \
- && DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \
- && echo Docker URL: $DOCKER_URL \
- && curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \
- && ls -lha /tmp/docker.tgz \
- && tar -xz -C /tmp -f /tmp/docker.tgz \
- && mv /tmp/docker/* /usr/bin \
- && rm -rf /tmp/docker /tmp/docker.tgz \
- && which docker \
- && (docker version || true)
- # docker compose
- RUN COMPOSE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/docker-compose-latest" \
- && curl --silent --show-error --location --fail --retry 3 --output /usr/bin/docker-compose $COMPOSE_URL \
- && chmod +x /usr/bin/docker-compose \
- && docker-compose version
- # install dockerize
- RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" \
- && curl --silent --show-error --location --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz $DOCKERIZE_URL \
- && tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz \
- && rm -rf /tmp/dockerize-linux-amd64.tar.gz \
- && dockerize --version
- RUN groupadd --gid 3434 worker \
- && useradd --uid 3434 --gid worker --shell /bin/bash --create-home worker \
- && echo 'worker ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-worker \
- && echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep
- # BEGIN IMAGE CUSTOMIZATIONS
- RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | INSTALL_DIRECTORY=/usr/local/bin sh
- RUN curl -sSL https://github.com/gotestyourself/gotestsum/releases/download/v0.3.4/gotestsum_0.3.4_linux_amd64.tar.gz | \
- tar -xz -C /usr/local/bin gotestsum
- # END IMAGE CUSTOMIZATIONS
- USER worker
- CMD ["/bin/sh"]
- #
- # Install Java 11 LTS / OpenJDK 11
- #
- RUN if grep -q Debian /etc/os-release && grep -q stretch /etc/os-release; then \
- echo 'deb http://deb.debian.org/debian stretch-backports main' | sudo tee -a /etc/apt/sources.list.d/stretch-backports.list; \
- elif grep -q Ubuntu /etc/os-release && grep -q xenial /etc/os-release; then \
- sudo apt-get update && sudo apt-get install -y software-properties-common && \
- sudo add-apt-repository -y ppa:openjdk-r/ppa; \
- fi && \
- sudo apt-get update && sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless && \
- sudo apt-get install -y bzip2 libgconf-2-4 # for extracting firefox and running chrome, respectively
- ENV OPENSSL_CONF /
- ## install phantomjs
- #
- RUN PHANTOMJS_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/phantomjs-latest.tar.bz2" \
- && sudo apt-get install libfontconfig \
- && curl --silent --show-error --location --fail --retry 3 --output /tmp/phantomjs.tar.bz2 ${PHANTOMJS_URL} \
- && tar -x -C /tmp -f /tmp/phantomjs.tar.bz2 \
- && sudo mv /tmp/phantomjs-*-linux-x86_64/bin/phantomjs /usr/local/bin \
- && rm -rf /tmp/phantomjs.tar.bz2 /tmp/phantomjs-* \
- && phantomjs --version
- # install firefox
- # If you are upgrading to any version newer than 47.0.1, you must check the compatibility with
- # selenium. See https://github.com/SeleniumHQ/selenium/issues/2559#issuecomment-237079591
- RUN FIREFOX_URL="https://s3.amazonaws.com/circle-downloads/firefox-mozilla-build_47.0.1-0ubuntu1_amd64.deb" \
- && curl --silent --show-error --location --fail --retry 3 --output /tmp/firefox.deb $FIREFOX_URL \
- && echo 'ef016febe5ec4eaf7d455a34579834bcde7703cb0818c80044f4d148df8473bb /tmp/firefox.deb' | sha256sum -c \
- && sudo dpkg -i /tmp/firefox.deb || sudo apt-get -f install \
- && sudo apt-get install -y libgtk3.0-cil-dev libasound2 libasound2 libdbus-glib-1-2 libdbus-1-3 \
- && rm -rf /tmp/firefox.deb \
- && firefox --version
- # install chrome
- 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 \
- && (sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb || sudo apt-get -fy install) \
- && rm -rf /tmp/google-chrome-stable_current_amd64.deb \
- && sudo sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
- "/opt/google/chrome/google-chrome" \
- && google-chrome --version
- RUN CHROME_VERSION="$(google-chrome --version)" \
- && export CHROMEDRIVER_RELEASE="$(echo $CHROME_VERSION | sed 's/^Google Chrome //')" && export CHROMEDRIVER_RELEASE=${CHROMEDRIVER_RELEASE%%.*} \
- && CHROMEDRIVER_VERSION=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROMEDRIVER_RELEASE}) \
- && curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" \
- && cd /tmp \
- && unzip chromedriver_linux64.zip \
- && rm -rf chromedriver_linux64.zip \
- && sudo mv chromedriver /usr/local/bin/chromedriver \
- && sudo chmod +x /usr/local/bin/chromedriver \
- && chromedriver --version
- # install libgconf-2-4 manually since chrome no longer pulls it in automatically
- RUN sudo apt-get install -y libgconf-2-4
- # start xvfb automatically to avoid needing to express in circle.yml
- ENV DISPLAY :99
- RUN printf '#!/bin/sh\nXvfb :99 -screen 0 1280x1024x24 &\nexec "$@"\n' > /tmp/entrypoint \
- && chmod +x /tmp/entrypoint \
- && sudo mv /tmp/entrypoint /docker-entrypoint.sh
- # ensure that the build agent doesn't override the entrypoint
- LABEL com.circleci.preserve-entrypoint=true
- ENTRYPOINT ["/docker-entrypoint.sh"]
- CMD ["/bin/sh"]
- RUN sudo apt-get update
- RUN sudo apt-get install build-essential libssl-dev -y
- RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | sh
- RUN wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
- && sudo dpkg -i /tmp/libpng12.deb \
- && rm /tmp/libpng12.deb
- USER worker
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement