Skip to content

Instantly share code, notes, and snippets.

@hxegon
Last active October 23, 2017 18:49
Show Gist options
  • Save hxegon/d0cce30aba7985db6f6aca5223e7b599 to your computer and use it in GitHub Desktop.
Save hxegon/d0cce30aba7985db6f6aca5223e7b599 to your computer and use it in GitHub Desktop.
alpine dockerfile example
# forgive me for any noob stuff, this is like my second dockerfile :P
FROM ruby:2.3-alpine
WORKDIR /app
COPY Gemfile* ./
# the --virtual <name> flag groups packages by name. I use this (sometimes) to remove build deps once everything is installed.
# All bulid stuff in one RUN command to reduce number of image layers
RUN apk update && \
apk add --no-cache --virtual build-deps ruby-dev build-base git postgresql-dev && \
apk add --no-cache --virtual run-deps libpq nodejs && \
gem install bundler --no-ri --no-rdoc && \
bundle install
# apk del build-deps # disabled for development so I can go in the container and try stuff
COPY . .
EXPOSE 3000
CMD [ "rails", "s", "-p", "3000", "-b", "0.0.0.0" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment