Sha256: a7617173e17611b8ac14876be4c606de22af04fc0b643d51e09da23a03ff8986

Contents?: true

Size: 1.79 KB

Versions: 36

Compression:

Stored size: 1.79 KB

Contents

The docker cache task builds a docker image using the `Dockerfile.base` file and
updates the FROM `Dockerfile` image with the generated image from `Dockerfile.base`.

## Summarized Example

    ufo docker base
    ufo docker base --no-push # do not push the image to the registry

Docker image `org/repo:base-2016-10-21T15-50-57-88071f5` built.

## Detailed Example

Let's see the command in action:

    $ ufo docker base
    Building docker image with:
      docker build -t org/repo:base-2017-06-12T14-36-44-2af505e -f Dockerfile.base .
      ...
    Pushed org/repo:base-2017-06-12T14-36-44-2af505e docker image. Took 28s.
    The Dockerfile FROM statement has been updated with the latest base image:
      org/repo:base-2017-06-12T14-36-44-2af505e

Some of the output has been excluded so we can focus on the essential parts to point out. First, notice that the command simply shells out to the docker command and calls:

    docker build -t org/repo:base-2017-06-12T14-36-44-2af505e -f Dockerfile.base .

It uses the docker `-f Dockerfile.base` option to build the base image.  It names the image with `org/repo:base-2017-06-12T14-36-44-2af505e`.  The image tag contains useful information: the timestamp and exact git sha of the code.  The image gets pushed to a registry immediately.

## Dockerfile FROM updated

Notice at the very end, the *current* `Dockerfile`'s FROM statement has been updated with the newly built base Docker image automatically.  This saves you from forgetting to copy and paste it the `Dockerfile` yourself.

If you're using a [Dockerfile.erb](https://ufoships.com/docs/extras/dockerfile-erb/), then ufo will update the `.ufo/state/data.yml` file instead.  It assumes you're using a `Dockerfile.erb` that looks something like this:

```Dockerfile
FROM <%= @base_image %>
# ...
CMD ["bin/web"]
```

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ufo-6.3.13 lib/ufo/cli/help/docker/base.md
ufo-6.3.12 lib/ufo/cli/help/docker/base.md
ufo-6.3.11 lib/ufo/cli/help/docker/base.md
ufo-6.3.10 lib/ufo/cli/help/docker/base.md
ufo-6.3.9 lib/ufo/cli/help/docker/base.md
ufo-6.3.8 lib/ufo/cli/help/docker/base.md
ufo-6.3.7 lib/ufo/cli/help/docker/base.md
ufo-6.3.6 lib/ufo/cli/help/docker/base.md
ufo-6.3.5 lib/ufo/cli/help/docker/base.md
ufo-6.3.4 lib/ufo/cli/help/docker/base.md
ufo-6.3.3 lib/ufo/cli/help/docker/base.md
ufo-6.3.2 lib/ufo/cli/help/docker/base.md
ufo-6.3.1 lib/ufo/cli/help/docker/base.md
ufo-6.3.0 lib/ufo/cli/help/docker/base.md
ufo-6.2.5 lib/ufo/cli/help/docker/base.md
ufo-6.2.4 lib/ufo/cli/help/docker/base.md
ufo-6.2.3 lib/ufo/cli/help/docker/base.md
ufo-6.2.2 lib/ufo/cli/help/docker/base.md
ufo-6.2.1 lib/ufo/cli/help/docker/base.md
ufo-6.2.0 lib/ufo/cli/help/docker/base.md