Last active
August 31, 2017 22:27
-
-
Save heug/c1b3b32d7d135abf585494144aa0b328 to your computer and use it in GitHub Desktop.
ezCater Dockerfiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
working_directory: ~/ezcater | |
docker: | |
- image: heug/ezcater:2.4 | |
environment: | |
CIRCLE_CI: true | |
RACK_ENV: test | |
RAILS_ENV: test | |
DATABASE_URL: postgres://localhost/circle_ruby_test | |
PGHOST: 127.0.0.1 | |
- image: circleci/postgres:9.5.8-alpine-postgis-ram | |
environment: | |
POSTGRES_USER: circleci | |
POSTGRES_DB: circle_ruby_test | |
parallelism: 6 | |
steps: | |
- checkout | |
- restore_cache: | |
key: ruby-cache-{{ .Branch }}-{{ checksum "Gemfile" }} | |
- run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 | |
- run: bundle update rake | |
- save_cache: | |
key: ruby-cache-{{ .Branch }}-{{ checksum "Gemfile" }} | |
paths: | |
- vendor/bundle | |
- run: bundle exec rake db:create db:structure:load | |
- run: | |
command: | | |
bundle exec rspec --format progress \ | |
--format RspecJunitFormatter \ | |
-o tmp/artifacts/rspec.xml \ | |
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings --timings-type=classname) | |
- run: bin/circle_afer_tests | |
- store_artifacts: | |
path: tmp/artifacts/rspec.xml | |
- store_artifacts: | |
path: spec/examples.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM heug/ruby-trusty:2.3.3-1 | |
USER root | |
## BEGIN CIRCLECI PREAMBLE | |
# 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 | |
# RUN apt-get -qq update && apt-get -qq -y install curl | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update && apt-get install software-properties-common && add-apt-repository ppa:openjdk-r/ppa | |
RUN apt-get update && apt-get install -y \ | |
git mercurial xvfb \ | |
locales sudo openssh-client ca-certificates tar gzip parallel \ | |
net-tools netcat unzip zip bzip2 \ | |
curl openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk openjdk-8-jdk-headless | |
# 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 | |
RUN JQ_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/jq-latest" \ | |
&& curl --silent --show-error --location --fail --retry 3 --output /usr/bin/jq $JQ_URL \ | |
&& chmod +x /usr/bin/jq \ | |
&& 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]*-ce\.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 circleci \ | |
&& useradd --uid 3434 --gid circleci --shell /bin/bash --create-home circleci \ | |
&& echo 'circleci ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-circleci \ | |
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep | |
## END CIRCLECI PREAMBLE | |
## BEGIN NODE INSTALL | |
RUN groupadd --gid 1000 node \ | |
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node | |
# gpg keys listed at https://github.com/nodejs/node#release-team | |
RUN set -ex \ | |
&& for key in \ | |
9554F04D7259F04124DE6B476D5A82AC7E37093B \ | |
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | |
FD3A5288F042B6850C66B31F09FE44734EB7990E \ | |
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | |
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | |
B9AE9905FFD7803F25714661B63B535A4C206CA9 \ | |
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | |
56730D5401028683275BD23C23EFEFE93C4CFFFE \ | |
; do \ | |
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ | |
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ | |
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ | |
done | |
ENV NPM_CONFIG_LOGLEVEL info | |
ENV NODE_VERSION 4.2.6 | |
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ | |
&& case "${dpkgArch##*-}" in \ | |
amd64) ARCH='x64';; \ | |
ppc64el) ARCH='ppc64le';; \ | |
s390x) ARCH='s390x';; \ | |
arm64) ARCH='arm64';; \ | |
armhf) ARCH='armv7l';; \ | |
*) echo "unsupported architecture"; exit 1 ;; \ | |
esac \ | |
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ | |
&& curl -SLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | |
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ | |
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ | |
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 \ | |
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ | |
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs | |
ENV YARN_VERSION 0.24.4 | |
RUN set -ex \ | |
&& for key in \ | |
6A010C5166006599AA17F08146C2130DFD2497F5 \ | |
; do \ | |
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ | |
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ | |
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ | |
done \ | |
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ | |
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ | |
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ | |
&& mkdir -p /opt/yarn \ | |
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ | |
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ | |
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ | |
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz | |
## END NODE INSTALL | |
## BEGIN BROWSERS INSTALL | |
# install java 8 | |
# | |
RUN if grep Debian /etc/*release > /dev/null ; then \ | |
echo "deb http://http.us.debian.org/debian/ jessie-backports main" | sudo tee -a /etc/apt/sources.list \ | |
&& echo "deb-src http://http.us.debian.org/debian/ jessie-backports main" | sudo tee -a /etc/apt/sources.list \ | |
&& sudo apt-get update; sudo apt-get install -t jessie-backports openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk openjdk-8-jdk-headless \ | |
; else \ | |
sudo apt-get update; sudo apt-get install openjdk-8-jre openjdk-8-jre-headless openjdk-8-jdk openjdk-8-jdk-headless \ | |
; fi | |
## 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 export CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 http://chromedriver.storage.googleapis.com/LATEST_RELEASE) \ | |
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/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 | |
# 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 | |
## END BROWSERS INSTALL | |
## BEGIN IMAGE CUSTOMIZATIONS | |
RUN apt-get update && apt-get install qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x postgresql-client imagemagick libpq-dev | |
RUN gem update --system | |
RUN gem install bundler | |
## END IMAGE CUSTOMIZATIONS | |
USER circleci | |
ENTRYPOINT ["/docker-entrypoint.sh"] | |
CMD ["/bin/sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
USER root | |
## TOOLS | |
RUN apt-get update && apt-get install wget xz-utils autoconf build-essential zlib1g-dev apt-transport-https libssl-dev curl libreadline-dev -y | |
## END TOOLS | |
# skip installing gem documentation | |
RUN mkdir -p /usr/local/etc \ | |
&& { \ | |
echo 'install: --no-document'; \ | |
echo 'update: --no-document'; \ | |
} >> /usr/local/etc/gemrc | |
ENV RUBY_MAJOR 2.3 | |
ENV RUBY_VERSION 2.3.3 | |
ENV RUBY_DOWNLOAD_SHA256 1a4fa8c2885734ba37b97ffdb4a19b8fba0e8982606db02d936e65bac07419dc | |
ENV RUBYGEMS_VERSION 2.6.11 | |
# some of ruby's build scripts are written in ruby | |
# we purge system ruby later to make sure our final image uses what we just built | |
RUN set -ex \ | |
\ | |
&& buildDeps=' \ | |
bison \ | |
libgdbm-dev \ | |
ruby \ | |
' \ | |
&& apt-get update \ | |
&& apt-get install -y --no-install-recommends $buildDeps \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
\ | |
&& wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ | |
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \ | |
\ | |
&& mkdir -p /usr/src/ruby \ | |
&& tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \ | |
&& rm ruby.tar.xz \ | |
\ | |
&& cd /usr/src/ruby \ | |
\ | |
# hack in "ENABLE_PATH_CHECK" disabling to suppress: | |
# warning: Insecure world writable dir | |
&& { \ | |
echo '#define ENABLE_PATH_CHECK 0'; \ | |
echo; \ | |
cat file.c; \ | |
} > file.c.new \ | |
&& mv file.c.new file.c \ | |
\ | |
&& autoconf \ | |
&& ./configure --disable-install-doc --enable-shared \ | |
&& make -j"$(nproc)" \ | |
&& make install \ | |
\ | |
&& apt-get purge -y --auto-remove $buildDeps \ | |
&& cd / \ | |
&& rm -r /usr/src/ruby \ | |
\ | |
&& gem update --system "$RUBYGEMS_VERSION" | |
ENV BUNDLER_VERSION 1.14.6 | |
RUN gem install bundler --version "$BUNDLER_VERSION" | |
# install things globally, for great justice | |
# and don't create ".bundle" in all our apps | |
ENV GEM_HOME /usr/local/bundle | |
ENV BUNDLE_PATH="$GEM_HOME" \ | |
BUNDLE_BIN="$GEM_HOME/bin" \ | |
BUNDLE_SILENCE_ROOT_WARNING=1 \ | |
BUNDLE_APP_CONFIG="$GEM_HOME" | |
ENV PATH $BUNDLE_BIN:$PATH | |
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \ | |
&& chmod 777 "$GEM_HOME" "$BUNDLE_BIN" | |
CMD [ "irb" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment