Skip to content

andyl/dockerfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerfile

An Elixir library that generates Phoenix-ready Dockerfiles by caching the Phoenix template and hexpm/elixir Docker Hub tag data in-repo, then resolving concrete image tags offline at generation time. It exists to sidestep the network-timeout bug in mix phx.gen.release --dockerfile.

Installation

def deps do
  [
    {:dockerfile, "~> 0.1.0"}
  ]
end

Usage

Sync is a dev-time operation — run periodically (e.g. weekly) and commit the resulting priv/ artifacts.

# 1. Cache Phoenix's Dockerfile.eex and dockerignore.eex templates.
Dockerfile.sync_templates()

# 2. Sync hexpm/elixir tags for a given Elixir major.minor.
Dockerfile.sync_tags("1.19")

# 3. Generate ./Dockerfile and ./.dockerignore for the current project.
Dockerfile.generate_dockerfile()
Dockerfile.generate_dockerignore()

sync_tags/2 is incremental: when priv/tags/<minor>.csv already exists, it walks the Docker Hub listing newest-first only until it sees a page of already-known tags, merges any new tags, prunes anything older than 6 months, and atomically rewrites the file (returning {:ok, :no_change} when nothing changed). On first run for a minor — or when the CSV is missing — it bootstraps via full pagination. Tracked minors live under config :dockerfile, :tracked_minors.

generate_dockerfile/1 accepts overrides for :elixir_vsn, :erlang_vsn, :os_name, :os_release, :slim, and :out_path. Defaults: introspected Elixir/Erlang versions, debian/trixie, non-slim, ./Dockerfile.

About

Dockerfile generator for Elixir Projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors