Dockerize rails app on alpine
Dockerfile…
FROM ruby:3.0.1-alpine3.13
RUN mkdir /app
WORKDIR /app
RUN apk update && \
apk add --update \
make \
gcc \
libc-dev \
sqlite-dev \
g++ \
tzdata \
nodejs \
yarn
RUN gem install rails
COPY Gemfile .
RUN bundle install
COPY . .
EXPOSE 3000
CMD [ "rails", "server", "--binding", "0.0.0.0"]
To build…
docker build --tag='rails_app' .
Running …
docker run \
-it \
--volume="${ROOT_DIR}":/app \
--rm \
--workdir=/app \
--publish="3000:3000" \
rails_app;
set up may change if using postgres or other database, but this should be a good starting block