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
COPY --chown=app:app --from=my-app:compiler /home/app/public /home/app/public | |
COPY --chown=app:app --from=my-app:compiler /home/app/tmp /home/app/tmp |
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
############################### | |
# Stage compiler | |
FROM runner as compiler | |
LABEL description="Builds a compiler image used to compile assets" | |
# Copy cached compiled assets to avoid re-compiling them | |
# We use latest compiler image to get already compiled assets | |
# and save lots of time on assets compilation for this new image | |
COPY --chown=app:app --from=my-app:compiler /home/app/public /home/app/public | |
COPY --chown=app:app --from=my-app:compiler /home/app/tmp /home/app/tmp |
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
############################### | |
# Stage runner | |
FROM ruby as runner | |
LABEL description="Builds an image ready to be run" | |
# Install runtime deps and create non-root user. | |
# | |
# If you need to install specific libraries for test environment | |
# please use a virtual pkg holder you can easily remove on the | |
# `release` stage. |
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
###################### | |
# Stage: bundler | |
FROM ruby as bundler | |
LABEL description="Install and cache gems for all environments" | |
WORKDIR /home/app | |
# Copy the Gemfile and Gemfile.lock | |
COPY Gemfile* /home/app/ |
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
###################### | |
# Stage: ruby | |
FROM ruby:2.5.1-alpine3.7 as ruby | |
LABEL description="Base ruby image used by other stages" |
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
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
ruby '2.5.1' | |
gem 'rails', '~> 5.2.0' | |
gem 'puma', '~> 3.11' | |
gem 'sass-rails', '~> 5.0' | |
group :development, :test do |
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:2.5.1-alpine3.7 | |
WORKDIR /home/app | |
RUN apk add --update --no-cache \ | |
build-base \ | |
libxml2-dev \ | |
libxslt-dev \ | |
nodejs \ | |
tzdata |
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
# foo/lib/foo.rb | |
require 'dry/system' | |
require 'foo/version' | |
module Foo | |
Dry::System.register_provider( | |
:foo, | |
boot_path: Pathname(__dir__).join('foo/components').realpath | |
) | |
end |
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
defmodule Rabbit do | |
use Supervisor | |
def start_link do | |
Supervisor.start_link(__MODULE__, []) | |
end | |
def init(_opts) do | |
children = [ | |
worker(Rabbit.ConnectionPool, []), |
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
defmodule Rabbit.ConnectionWorker do | |
use Connection | |
def start_link(opts) do | |
Connection.start_link(__MODULE__, opts) | |
end | |
def init(opts) do | |
state = %{opts: opts, conn: nil} | |
{:connect, nil, state} |