Skip to content

Instantly share code, notes, and snippets.

@noelrappin
Created May 10, 2022 11:30
Show Gist options
  • Save noelrappin/4cb0dbd7ef5bd5c855219d1e48dce8e1 to your computer and use it in GitHub Desktop.
Save noelrappin/4cb0dbd7ef5bd5c855219d1e48dce8e1 to your computer and use it in GitHub Desktop.
Docker Setup for workshop
version: "3.9"
services:
web:
build: .
command: bash -c "bundle && bin/dev"
ports:
- "3000:3000"
volumes:
- .:/myapp
- gem_cache:/gems:delegated
tty: true
stdin_open: true
links:
- redis
redis:
image: redis:latest
ports:
- "6379:6379"
volumes:
- "redis:/data"
volumes:
gem_cache: {}
redis:
# syntax=docker/dockerfile:1
FROM ruby:3.1.2
RUN apt-get update -qq && apt-get install -y sqlite3
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Configure the main process to run when running the image
CMD ["rails", "server", "-b", "0.0.0.0"]
#!/bin/bash
set -e
# Remove a potentially pre-existing server.pid for Rails.
rm -f /myapp/tmp/pids/server.pid
# Then exec the container's main process (what's set as CMD in the Dockerfile).
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment