<commit_before># Packer Docker Container

How we build packer docker images. We push these to
https://hub.docker.com/r/hashicorp/packer/ after every packer release.

Releases are tagged from the `light` version.

### Usage

This repository automatically builds containers for using the
[`packer`](https://packer.io) command line program. It contains two distinct
varieties of build, a `light` version, which just contains the binary, and
a `full` version while compiles the binary from source inside the container
before exposing it for use. Which you want will depend on use.

##### `light` (default)

The `light` version of this container will copy the current stable version of
the binary into the container, and set it for use as the default entrypoint.
This will be the best option for most uses, and if you are just looking to run
the binary from a container. The `latest` tag also points to this version.

You can use this version with the following:
```shell
docker run -i -t hashicorp/packer:light <command>
```

##### `full`

The `full` version of this container contains all of the source code found in
the parent [repository](https://github.com/hashicorp/packer). Using [Google's
official `golang` image](https://hub.docker.com/_/golang/) as a base, this
container will copy the source from the `master` branch, build the binary, and
expose it for running. Since the build is done on [Docker
Hub](https://hub.docker.com/r/hashicorp), the container is ready for use.
Because all build artifacts are included, it should be quite a bit larger than
the `light` image. This version of the container is useful for development or
debugging.

You can use this version with the following:
```shell
docker run -i -t hashicorp/packer:full <command>
```<commit_msg>update readme with clearer usage example for build command<commit_after># Packer Docker Container

How we build packer docker images. We push these to
https://hub.docker.com/r/hashicorp/packer/ after every packer release.

Releases are tagged from the `light` version.

### Usage

This repository automatically builds containers for using the
[`packer`](https://packer.io) command line program. It contains two distinct
varieties of build, a `light` version, which just contains the binary, and
a `full` version while compiles the binary from source inside the container
before exposing it for use. Which you want will depend on use.

##### `light` (default)

The `light` version of this container will copy the current stable version of
the binary into the container, and set it for use as the default entrypoint.
This will be the best option for most uses, and if you are just looking to run
the binary from a container. The `latest` tag also points to this version.

You can use this version with the following:
```shell
docker run -i -t <args> hashicorp/packer:light <command>
```

##### `full`

The `full` version of this container contains all of the source code found in
the parent [repository](https://github.com/hashicorp/packer). Using [Google's
official `golang` image](https://hub.docker.com/_/golang/) as a base, this
container will copy the source from the `master` branch, build the binary, and
expose it for running. Since the build is done on [Docker
Hub](https://hub.docker.com/r/hashicorp), the container is ready for use.
Because all build artifacts are included, it should be quite a bit larger than
the `light` image. This version of the container is useful for development or
debugging.

You can use this version with the following:
```shell
docker run -i -t <args> hashicorp/packer:full <command>
```

#### Running a build:

The easiest way to run a command that references a file is to bind mount the
file on the docker image:

```shell
docker run -it \
	--mount type=bind,source=/absolute/path/to/template.json,target=/mnt/template.json \
	hashicorp/packer:latest build /mnt/template.json
```

If you have several files you need Packer to have access to, you'll want to
bind mount a directory containing all of those files:

```shell
docker run -it \
    --mount type=bind,source=/absolute/path/to/test_docker_packer,target=/mnt/test_docker_packer \
    hashicorp/packer:latest build \
    --var-file /mnt/test_docker_packer/vars.json \
    /mnt/test_docker_packer/template.json
```
{'fraction_non_alphanumeric': 0.08588813479990638, 'fraction_numerical': 0.0, 'mean_word_length': 4.430749682337992, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1825664', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1161, 'n_words': 586}