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 release | |
FROM runner as release | |
LABEL description="Builds a release image removing unneeded files and dependencies" | |
# Removes development and test gems by re-running the bundle | |
# install command using cached gems and simply removing unneeded | |
# gems using the clean option. | |
RUN bundle install --local --clean --without development test \ | |
# Remove unneeded cached gems |
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 wkhtmltopdf | |
FROM madnight/docker-alpine-wkhtmltopdf as wkhtmltopdf |
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 wkhtmltopdf | |
FROM madnight/docker-alpine-wkhtmltopdf as wkhtmltopdf | |
###################### | |
# 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
query { | |
records(first: 100) { | |
pageInfo { | |
hasNextPage | |
endCursor | |
} | |
edges { | |
node { | |
id | |
} |
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 MyApp.StreamPaginator do | |
def stream(query, args \\ %{first: 100}) do | |
init = fn -> end | |
next = fn -> end | |
stop = fn -> end | |
Stream.resource(init, next, stop) | |
end | |
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 MyApp.StreamPaginator do | |
def stream(query, args \\ %{first: 100}) do | |
init = fn -> request(query, args) end | |
next = fn -> nil end | |
stop = fn -> nil end | |
Stream.resource(init, next, stop) | |
end | |
defp request(query, args) 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
defmodule MyApp.StreamPaginator do | |
def stream(query, args \\ %{first: 100}) do | |
# ... | |
next = &next/1 | |
# ... | |
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
defp next({nil, _query, _args} = acc), do: {:halt, acc} | |
defp next({%{"hasNextPage" => false}, _query, _args} = acc), do: {:halt, acc} |
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 MyApp.StreamPaginator do | |
def stream(query, args \\ %{first: 100}) do | |
init = fn -> request(query, args) end | |
next = &next/1 | |
stop = &Function.identity/1 | |
Stream.resource(init, next, stop) | |
end | |
defp request(query, args) do |