Sign inSign up

nullstone/rails

By nullstone

Updated 3 months ago

Opinionated image for rails Web Apps and APIs

Image
1

10K+

nullstone/rails repository overview

nullstone/rails

Rails Base Image that is optimized for production and configured to operate locally the same way. This image is very opinionated; however, not restrictive.

Quick Reference

Variants

This repository builds 2 variants of images: a base image and a webapp image.

The base image configures:

  • Server optimized for puma.
  • When making code changes locally, there is no need to rebuild/restart your container.
  • Logs are emitted to stdout.
  • Sets PORT env var to 80
  • On boot, POSTGRES_URL sets DB_ADAPTER=postgresql, DATABASE_URL=$POSTGRES_URL
  • On boot, MYSQL_URL sets DB_ADAPTER=mysql, DATABASE_URL=$MYSQL_URL

The webapp image additionally configures:

  • Preconfigures the image to attach nginx sidecar container. See below.
  • Changes PORT env var to 3000 to allow nginx to use port 80

Nginx sidecar

The webapp image is configured to optionally connect sidecar container running nginx. This pattern allows you to use nginx to serve static assets while the rails server serves dynamic requests.

docker-compose

See examples/webapp/prod.docker-compose.yml for a docker compose that mimics a production environment.

Nullstone

The following Nullstones modules provide one-click addition of an nginx sidecar:

Static Assets

Make sure to place all static content into /app/public inside the container. With a typical rails setup, this is done with the following in Dockerfile.

...
COPY . . # copies all rails code including `./public` into `/app`
RUN bundle exec rake assets:precompile
RUN bundle exec rake assets:clean

Tag summary

Content type

Image

Digest

sha256:e82291a71

Size

313.6 MB

Last updated

3 months ago

docker pull nullstone/rails