How to build new image using existing Dockerfile?



I got issue with make .drone.yml file.
I have existing Dockerfile on machine where working my drone server.

Now I want build new image using this Dockerfile, when somebody push changes to repository.

    image: "/tmp/Dockerfile" 

and different solutions using compose directive not working.
Also I can’t find example and any information.

Have you an idea to do this?
Thanks in advance!


You probably need to start with a clear understanding about how the Drone pipeline works, what the image property means, and so on. I haven’t found any “fundamental Drone concepts” documentation, but start by taking a look at the documentation about Pipelines and Images, and then take a look at the existing Plugin Marketplace (a slight misnomer, as you don’t have to pay).

For every step in the pipeline, the image property tells Drone about an already built image that it should use to perform the actions you want. In your case, you want to “build a docker image”, so the build step should make use of the Docker plugin. More than likely, your .drone.yml file will end up looking something like:

    image: plugins/docker         # <=== this is the plugin the "build" step uses
    dockerfile: /tmp/Dockerfile   # <=== this is your Dockerfile, so the plugin can find it

In addition to building the Docker image, you need to publish it to a registry somewhere, otherwise you won’t be able to make use of the newly-built image. The Docker plugin can also do this for you, if you’re publishing to the default Docker registry. If you’re using AWS or GCR or some other registry, you might need to use a different plugin instead of “docker”… it all depends on your particular scenario.


@bradrydzewski: This topic probably belongs in “General Discussion”, but I haven’t been active enough here to have those privileges yet. Thanks!