Opinionated image for rails Web Apps and APIs
10K+
Rails Base Image that is optimized for production and configured to operate locally the same way. This image is very opinionated; however, not restrictive.
Dockerfile linksThis repository builds 2 variants of images: a base image and a webapp image.
The base image configures:
PORT env var to 80POSTGRES_URL sets DB_ADAPTER=postgresql, DATABASE_URL=$POSTGRES_URLMYSQL_URL sets DB_ADAPTER=mysql, DATABASE_URL=$MYSQL_URLThe webapp image additionally configures:
PORT env var to 3000 to allow nginx to use port 80The 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.
See examples/webapp/prod.docker-compose.yml for a docker compose that mimics a production environment.
The following Nullstones modules provide one-click addition of an nginx sidecar:
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
Content type
Image
Digest
sha256:e82291a71…
Size
313.6 MB
Last updated
3 months ago
docker pull nullstone/rails