|
| 1 | +# |
| 2 | +# rules_ruby circleci Docker file. |
| 3 | +# |
| 4 | +FROM ruby:2.6.5-stretch |
| 5 | + |
| 6 | +# make Apt non-interactive |
| 7 | +RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90circleci \ |
| 8 | + && echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90circleci |
| 9 | + |
| 10 | +ENV DEBIAN_FRONTEND=noninteractive |
| 11 | + |
| 12 | +# Debian Jessie is EOL'd and original repos don't work. |
| 13 | +# Switch to the archive mirror until we can get people to |
| 14 | +# switch to Stretch. |
| 15 | +RUN if grep -q Debian /etc/os-release && grep -q jessie /etc/os-release; then \ |
| 16 | + rm /etc/apt/sources.list \ |
| 17 | + && echo "deb http://archive.debian.org/debian/ jessie main" >> /etc/apt/sources.list \ |
| 18 | + && echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list \ |
| 19 | + ; fi |
| 20 | + |
| 21 | +# Make sure PATH includes ~/.local/bin |
| 22 | +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155 |
| 23 | +# This only works for root. The circleci user is done near the end of this Dockerfile |
| 24 | +RUN echo 'PATH="$HOME/.local/bin:$PATH"' >> /etc/profile.d/user-local-path.sh |
| 25 | + |
| 26 | +# man directory is missing in some base images |
| 27 | +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 |
| 28 | +RUN apt-get update \ |
| 29 | + && mkdir -p /usr/share/man/man1 \ |
| 30 | + && apt-get install -y \ |
| 31 | + git mercurial xvfb apt \ |
| 32 | + locales sudo openssh-client ca-certificates tar gzip parallel \ |
| 33 | + net-tools netcat unzip zip bzip2 gnupg curl wget make |
| 34 | + |
| 35 | + |
| 36 | +# Set timezone to UTC by default |
| 37 | +RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime |
| 38 | + |
| 39 | +# Use unicode |
| 40 | +RUN locale-gen C.UTF-8 || true |
| 41 | +ENV LANG=C.UTF-8 |
| 42 | + |
| 43 | +# install jq |
| 44 | +RUN JQ_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/jq-latest" \ |
| 45 | + && curl --silent --show-error --location --fail --retry 3 --output /usr/bin/jq $JQ_URL \ |
| 46 | + && chmod +x /usr/bin/jq \ |
| 47 | + && jq --version |
| 48 | + |
| 49 | +# Install Docker |
| 50 | + |
| 51 | +# Docker.com returns the URL of the latest binary when you hit a directory listing |
| 52 | +# We curl this URL and `grep` the version out. |
| 53 | +# The output looks like this: |
| 54 | + |
| 55 | +#> # To install, run the following commands as root: |
| 56 | +#> 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 |
| 57 | +#> |
| 58 | +#> # Then start docker in daemon mode: |
| 59 | +#> /usr/local/bin/dockerd |
| 60 | + |
| 61 | +RUN set -ex \ |
| 62 | + && 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) \ |
| 63 | + && DOCKER_URL="https://download.docker.com/linux/static/stable/x86_64/${DOCKER_VERSION}" \ |
| 64 | + && echo Docker URL: $DOCKER_URL \ |
| 65 | + && curl --silent --show-error --location --fail --retry 3 --output /tmp/docker.tgz "${DOCKER_URL}" \ |
| 66 | + && ls -lha /tmp/docker.tgz \ |
| 67 | + && tar -xz -C /tmp -f /tmp/docker.tgz \ |
| 68 | + && mv /tmp/docker/* /usr/bin \ |
| 69 | + && rm -rf /tmp/docker /tmp/docker.tgz \ |
| 70 | + && which docker \ |
| 71 | + && (docker version || true) |
| 72 | + |
| 73 | +# docker compose |
| 74 | +RUN COMPOSE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/docker-compose-latest" \ |
| 75 | + && curl --silent --show-error --location --fail --retry 3 --output /usr/bin/docker-compose $COMPOSE_URL \ |
| 76 | + && chmod +x /usr/bin/docker-compose \ |
| 77 | + && docker-compose version |
| 78 | + |
| 79 | +# install dockerize |
| 80 | +RUN DOCKERIZE_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/dockerize-latest.tar.gz" \ |
| 81 | + && curl --silent --show-error --location --fail --retry 3 --output /tmp/dockerize-linux-amd64.tar.gz $DOCKERIZE_URL \ |
| 82 | + && tar -C /usr/local/bin -xzvf /tmp/dockerize-linux-amd64.tar.gz \ |
| 83 | + && rm -rf /tmp/dockerize-linux-amd64.tar.gz \ |
| 84 | + && dockerize --version |
| 85 | + |
| 86 | +RUN groupadd --gid 3434 circleci \ |
| 87 | + && useradd --uid 3434 --gid circleci --shell /bin/bash --create-home circleci \ |
| 88 | + && echo 'circleci ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-circleci \ |
| 89 | + && echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep |
| 90 | + |
| 91 | +RUN apt-get update && apt-get upgrade |
| 92 | + |
| 93 | +RUN apt-get install -y openjdk-8-jdk python2.7 python3 golang-go |
| 94 | + |
| 95 | +RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/v1.0/bazelisk-linux-amd64 \ |
| 96 | + && sudo chmod +x /usr/bin/bazel |
| 97 | + |
| 98 | +USER circleci |
| 99 | +ENV PATH /home/circleci/.local/bin:/home/circleci/bin:/usr/local/bin:/usr/bin:/bin:/sbin:${PATH} |
| 100 | + |
| 101 | +CMD ["/bin/sh"] |
0 commit comments