Created
January 29, 2022 22:32
-
-
Save nerdinand/76405f5f5fb06ca7bd9cf367e4910a11 to your computer and use it in GitHub Desktop.
Podman setup for Rails 7 (without compose or database)
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
FROM ruby:3.1 | |
# throw errors if Gemfile has been modified since Gemfile.lock | |
RUN bundle config --global frozen 1 | |
WORKDIR /usr/src/app | |
COPY Gemfile 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"] | |
COPY . . | |
EXPOSE 3000 | |
CMD ["bundle", "exec", "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 "$@" | |
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 | |
podman build -t rails7:latest . |
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 | |
podman run -p 3000:3000 rails7:latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment