Giter Site home page Giter Site logo

uduinc / packer-post-processor-docker-dockerfile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cornfeedhobo/packer-post-processor-docker-dockerfile

0.0 2.0 0.0 97 KB

A Packer post-processor plugin that sets Dockerfile metadata on Docker images

License: Apache License 2.0

Go 100.00%

packer-post-processor-docker-dockerfile's Introduction

Packer Dockerfile post-processor

This is a Packer post-processor plugin which allows setting Docker metadata on an artifact from the docker-tag post-processor.

Normally, Docker images built using Packer cannot include entrypoint, cmd, user, environment variables and other metadata that is available in Dockerfiles. This plugin will create a temporary Dockerfile and run docker build in an annonymous context. Most Dockerfile instructions are supported as json parametersp

Caveats

  • RUN, ADD, COPY, and ONBUILD are not supported because packer provisioners should be used for their functionality.
  • Docker no longer supports digests in FROM, thus a chained docker-tag post-processor is required.

Usage

In your packer template, configure the post processor:

{
  ...
  "post-processors": [
    [
      {
        "type": "docker-tag",
        "repository": "localhost/example"
      },
      {
        "type": "docker-dockerfile",
        "volume": ["/data"]
        "expose": [8080],
        "entrypoint": ["/entrypoint.sh"],
        "cmd": ["bash"],
        "env": {
          "FOO": "bar"
        }
      }
    ]
  ]
  ...
}

cmd and entrypoint can have either array or string values, this mirrors the Dockerfile format and functionality

See the Dockerfile reference for details.

Building

Install the necessary dependencies

$ go get -d ./...

To compile the Packer plugin, run go build.

$ go build

Put the binary packer-post-processor-docker-dockerfile into the bin directory of your choice

Acknowledgement

Sponsors

This plugin was made possible by Shiftgig

License

This plugin is released under the Apache License, Version 2.0.

Support

Please file an issue on the github repository if you think anything isn't working properly or an improvement is required.

This plugin was developed against Docker 1.8.1 and Packer 0.8.6.

packer-post-processor-docker-dockerfile's People

Contributors

cornfeedhobo avatar

Watchers

James Cloos avatar udu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.