A docker image to run Packer command line program with
Ansible provisioner support.
You can use this version with the following:
docker run <args> mdmansur/packer-ansible:latest <command>The easiest way to run a command that references a configuration with one or more template files, is to mount a volume for the local workspace.
Running packer init
docker run \
    -v `pwd`:/workspace -w /workspace \
    -e PACKER_PLUGIN_PATH=/workspace/.packer.d/plugins \
    mdmansur/packer-ansible:latest \
    init .We push images to https://hub.docker.com/repository/docker/mdmansur/packer-ansible .
- It uses packer light image as base.
 
FROM hashicorp/packer:$PACKER_VERSION- It installs ansible and py-pip packages. It removes apk cache files.
 
RUN apk add --update --no-cache ansible py-pip \
  && rm /var/cache/apk/*The pipeline is composed of the following jobs:
- 
Lint: Uses Hadolint as Dockefile linter.
 - 
Build: Build image and upload it as an artifact, so the following jobs can use it.
 - 
Scan: Uses Trivy tool to scan vulnerabilities on docker image. The pipeline continue in case of error on this job. It's only informative.
 - 
Execution: It's a simple test that runs this docker image and assert that it returns the correct Packer version.
 - 
Push: Publish image on dockerhub. This job is only executed when a new project tag is published.