## # Ruby 3.2 with Node.js 16.x. # # NOTE: Linted by hadolint. # # docker run --rm -i ghcr.io/hadolint/hadolint < docker/3.2/Dockerfile # # NOTE: A command to build image. # # cd convenient_service # cp Gemfile Gemfile.3.2 # docker build . -f docker/3.2/Dockerfile -t convenient_service:3.2 # # or `task docker:build:ruby_3.2` # # NOTE: A command to run bash in container. # # cd convenient_service # docker run --rm -it -v $(pwd):/gem convenient_service:3.2 bash # # or `task docker:bash:ruby_3.2` # # NOTE: If there are no memory, performance, or cost constraints, prefer to use as standard Linux distribution as it is possible. # In a general case, you simply won't have enough time to resolve all the "quirks" of more specific distributions if you are an application developer. # That is why a `slim` version is used instead of `alpine`. # Also `slim` is more similar to Ubuntu. # - https://github.com/timbru31/docker-ruby-node/tree/master/3.2/16 # - https://medium.com/swlh/alpine-slim-stretch-buster-jessie-bullseye-bookworm-what-are-the-differences-in-docker-62171ed4531d # - https://hub.docker.com/r/timbru31/ruby-node/tags # # NOTE: Gallium means Node.js 16.x. # https://github.com/nodejs/Release # FROM timbru31/ruby-node:3.2-slim-gallium ## # NOTE: `bundle install` dependencies. # RUN apt-get update -qq \ && apt-get install --no-install-recommends -y git \ && apt-get install --no-install-recommends -y make \ && apt-get install --no-install-recommends -y gcc \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN mkdir -p /gem WORKDIR /gem COPY . /gem ## # NOTE: Every container has its own copy of `Gemfile`. This way a developer doesn't need to delete `Gemfile.lock` all the time when changing containers. # - https://docs.docker.com/engine/reference/builder/#env # - https://stackoverflow.com/questions/48863711/is-it-possible-to-override-gemfile-for-local-development # ENV BUNDLE_GEMFILE=Gemfile.3.2 RUN bundle install RUN bundle exec appraisal install ## # NOTE: Installs `task`. # https://taskfile.dev/installation/#install-script # # NOTE: `task` is installed into `~/bin`. That is why `-b /bin` is used. See `echo ${PATH}` to debug. # RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /bin ## # NOTE: Is used to check whether a command is executed inside a Docker container. See Rakefile for examples. # https://stackoverflow.com/a/65942222/12201472 # ENV IN_DOCKER_CONTAINER=true