Created
May 10, 2022 11:30
-
-
Save noelrappin/4cb0dbd7ef5bd5c855219d1e48dce8e1 to your computer and use it in GitHub Desktop.
Docker Setup for workshop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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