Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created January 15, 2020 00:15
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 miguelmota/856e17e5d5dced113feb5bab4a7000b8 to your computer and use it in GitHub Desktop.
Save miguelmota/856e17e5d5dced113feb5bab4a7000b8 to your computer and use it in GitHub Desktop.
Dockerfile ruby standalone_migrations postgresql example
FROM ruby:2.6.5-alpine3.10
# Install dependencies
RUN apk update && apk add build-base bash postgresql-dev zlib-dev
# Install gems
RUN gem install rake dotenv pg standalone_migrations
# Set postgres environment variables
ENV POSTGRES_HOST=127.0.0.1
ENV POSTGRES_PORT=54320
ENV POSTGRES_USER=docker
ENV POSTGRES_PASS=docker
ENV POSTGRES_DBNAME=docker
# Copy local repo into docker
COPY migration/ /migration
# Set working directory to be migration directory
WORKDIR /migration
# Set the default command to run when starting the container
CMD ["rake", "db:migrate"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment