Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Created August 16, 2020 06:05
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 sinsoku/d7c5566f13e77b0c8248f8b1a1f3f07c to your computer and use it in GitHub Desktop.
Save sinsoku/d7c5566f13e77b0c8248f8b1a1f3f07c to your computer and use it in GitHub Desktop.
An image to edit rails credentials
# build:
# $ docker build -t rails_cred .
#
# usage:
# $ docker run -it --rm \
# -e RAILS_MASTER_KEY=$RAILS_MASTER_KEY \
# -v `pwd`/config/credentials.yml.enc:/app/config/credentials.yml.enc \
# -v `pwd`/config/credentials:/app/config/credentials \
# rails_cred
FROM ruby:2.7.1-alpine
WORKDIR /app
ENV RAILS_VERSION=6.0.3.2
ENV EDITOR=vim
RUN apk update && apk add --update \
build-base \
vim \
&& rm -rf /var/cache/apk/*
RUN gem i rails --no-document --version $RAILS_VERSION
RUN rails new \
--skip-gemfile \
--skip-git \
--skip-keeps \
--skip-action-mailer \
--skip-action-mailbox \
--skip-action-text \
--skip-active-record \
--skip-active-storage \
--skip-puma \
--skip-action-cable \
--skip-sprockets \
--skip-spring \
--skip-listen \
--skip-javascript \
--skip-turbolinks \
--skip-test \
--skip-system-test \
--skip-bootsnap \
--skip-webpack-install \
.
RUN bundle init \
&& echo "gem 'rails', '$RAILS_VERSION'" >> Gemfile \
&& bundle install
ENTRYPOINT ["bin/rails", "credentials:edit"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment