Skip to content

Instantly share code, notes, and snippets.

@yuriihabrusiev
Created April 5, 2024 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuriihabrusiev/3d7e7fecbd0dc8421eaa2f3db23ea085 to your computer and use it in GitHub Desktop.
Save yuriihabrusiev/3d7e7fecbd0dc8421eaa2f3db23ea085 to your computer and use it in GitHub Desktop.
Docked Rails
# Docked Rails
# Building:
# docker build -t docked-rails .
# Preparation:
# docker volume create ruby-bundle-cache
# alias docked='docker run --rm -it -v ${PWD}:/rails -u $(id -u):$(id -g) -v ruby-bundle-cache:/bundle -p 3030:3030 docked-rails'
# Usage:
# docked rails db:migrate
# docked rails server
ARG RUBY_VERSION=2.6.5
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y git build-essential pkg-config libpq-dev libvips
WORKDIR /rails
RUN mkdir /bundle && chmod -R ugo+rwt /bundle
VOLUME /bundle
ENV BUNDLE_PATH='/bundle'
ENV PATH="/bundle/ruby/$RUBY_VERSION/bin:${PATH}"
ENV BUNDLER_VERSION=2.4.7
RUN gem install bundler -v $BUNDLER_VERSION
ENV BINDING="0.0.0.0"
ENTRYPOINT [""]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment