docker-build-cacher 1.0 → 1.1
raw patch · 3 files changed
+21/−7 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- README.md +3/−3
- app/Main.hs +16/−2
- docker-build-cacher.cabal +2/−2
README.md view
@@ -86,15 +86,15 @@ export GIT_BRANCH=master export DOCKER_TAG=fancyapp:latest -docker-build-cacher Build # This will build the docker file-docker-build-cacher Cache # This will cache each of the stage results separately+docker-build-cacher build # This will build the docker file+docker-build-cacher cache # This will cache each of the stage results separately ``` Additionally, `docker-build-cacher` accepts the `DOCKERFILE` env variable in case the file is not present in the current directory: ```bash-DOCKERFILE=buildfiles/Dockerfile docker-build-cacher Build+DOCKERFILE=buildfiles/Dockerfile docker-build-cacher build ``` At the end of the process you can call `docker images` and see that it has created `fancyapp:latest`, and if you are using
app/Main.hs view
@@ -23,6 +23,8 @@ import Filesystem.Path (FilePath) import Language.Dockerfile hiding (Tag) import Prelude hiding (FilePath)+import Text.Read+import Text.ParserCombinators.ReadP hiding (choice) import Turtle {- Glossary:@@ -73,11 +75,23 @@ data Mode = Build | Cache- deriving (Read, Show)+ deriving (Show) +instance Read Mode where+ readPrec =+ Text.Read.choice $+ strValMap+ [ ("Build", Build) -- Accept both casings+ , ("build", Build)+ , ("Cache", Cache)+ , ("cache", Cache)+ ]+ where+ strValMap = map (\(x, y) -> lift $ string x >> return y)+ -- | Describes the arguments this script takes from the command line parser :: Parser Mode-parser = argRead "mode" "Whether to build or to cache (options: Build | Cache)"+parser = argRead "mode" "Whether to build or to cache (options: build | cache)" main = do mode <- options "Builds a docker file and caches its stages" parser -- Parse the CLI arguments as a Mode
docker-build-cacher.cabal view
@@ -1,5 +1,5 @@ name: docker-build-cacher-version: 1.0+version: 1.1 synopsis: Builds a services with docker and caches all of its intermediate stages description: A CLI tool to speed up multi-stage docker file builds by caching intermediate stages separately, so the can be used in successive builds.@@ -17,7 +17,7 @@ hs-source-dirs: app main-is: Main.hs ghc-options: -threaded -rtsopts -with-rtsopts=-N- build-depends: base >= 2 && < 4+ build-depends: base >= 4.9.1.0 && < 5 , turtle , language-dockerfile , containers