Skip to content

Instantly share code, notes, and snippets.

@gonssal
Last active September 21, 2019 01:36
Show Gist options
  • Save gonssal/51a09222fd624bc54f4ffa482ba2d10c to your computer and use it in GitHub Desktop.
Save gonssal/51a09222fd624bc54f4ffa482ba2d10c to your computer and use it in GitHub Desktop.
Ruby's Bundler Dockerfile
# This Dockerfile is aimed at building it from a directory containing a Gemfile.
# It installs the Gemfile packages and then gives you the "bundle exec" entry point.
#
# Usage:
# * docker build --tag=bundle-exec .
# * docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/src bundle-exec
# Example: docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/src bundle-exec compass compile -e production
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y bundler
# Buildtime
COPY Gemfile /tmp/Gemfile
RUN ["bundle", "install", "--gemfile=/tmp/Gemfile"]
# Runtime
VOLUME /src
WORKDIR /src
ENTRYPOINT ["bundle", "exec"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment