ℹ️ Took from https://www.freecodecamp.org/news/painless-rails-development-environment-setup-with-docker/
docker-compose build
docker-compose run --rm --service-ports ruby_dev
- inside bash
rails server -p $PORT -b 0.0.0.0
ℹ️ Took from https://www.freecodecamp.org/news/painless-rails-development-environment-setup-with-docker/
docker-compose build
docker-compose run --rm --service-ports ruby_dev
rails server -p $PORT -b 0.0.0.0
# More docs on docker-compose.yml => https://docs.docker.com/compose/compose-file/ | |
version: "3.7" | |
services: | |
ruby_dev: | |
build: . | |
container_name: ruby_container | |
ports: | |
- "3000:3000" | |
volumes: | |
- ./:/home/app |
# More docs on Dockerfile syntax => https://docs.docker.com/engine/reference/builder/ | |
# Set proper ruby version from the right image https://hub.docker.com/_/ruby?tab=tags | |
FROM ruby | |
WORKDIR /home/app | |
ENV PORT 3000 | |
EXPOSE $PORT | |
RUN gem install rails bundler | |
RUN gem install rails | |
RUN apt-get update -qq && apt-get install -y nodejs | |
ENTRYPOINT [ "/bin/bash" ] |