github.com/hashicorp/packer@v1.14.3/Dockerfile (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: BUSL-1.1
     3  
     4  # ========================================================================
     5  #
     6  # This Dockerfile contains multiple targets.
     7  # Use 'docker build --target=<name> .' to build one.
     8  # e.g. `docker build --target=release-light .`
     9  #
    10  # All non-dev targets have a PRODUCT_VERSION argument that must be provided
    11  # via --build-arg=PRODUCT_VERSION=<version> when building.
    12  # e.g. --build-arg PRODUCT_VERSION=1.11.2
    13  #
    14  # For local dev and testing purposes, please build and use the `dev` docker image.
    15  #
    16  # ========================================================================
    17  
    18  
    19  # Development docker image primarily used for development and debugging.
    20  # This image builds from the locally generated binary in ./bin/.
    21  # To generate the local binary, run `make dev`.
    22  FROM docker.mirror.hashicorp.services/alpine:latest as dev
    23  
    24  RUN apk add --no-cache git bash openssl ca-certificates
    25  
    26  COPY bin/packer /bin/packer
    27  
    28  ENTRYPOINT ["/bin/packer"]
    29  
    30  # Light docker image which can be used to run the binary from a container.
    31  # This image builds from the locally generated binary in ./bin/, and from CI-built binaries within CI.
    32  # To generate the local binary, run `make dev`.
    33  # This image is published to DockerHub under the `light`, `light-$VERSION`, and `latest` tags.
    34  FROM docker.mirror.hashicorp.services/alpine:latest as release-light
    35  
    36  ARG PRODUCT_VERSION
    37  ARG BIN_NAME
    38  
    39  # TARGETARCH and TARGETOS are set automatically when --platform is provided.
    40  ARG TARGETOS TARGETARCH
    41  
    42  LABEL name="Packer" \
    43        maintainer="HashiCorp Packer Team <packer@hashicorp.com>" \
    44        vendor="HashiCorp" \
    45        version=$PRODUCT_VERSION \
    46        release=$PRODUCT_VERSION \
    47        summary="Packer is a tool for creating identical machine images for multiple platforms from a single source configuration." \
    48        description="Packer is a tool for creating identical machine images for multiple platforms from a single source configuration. Please submit issues to https://github.com/hashicorp/packer/issues" \
    49        org.opencontainers.image.licenses="BUSL-1.1"
    50  
    51  RUN apk add --no-cache git bash wget openssl gnupg xorriso
    52  
    53  COPY dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/
    54  RUN mkdir -p /usr/share/doc/Packer
    55  COPY LICENSE /usr/share/doc/Packer/LICENSE.txt
    56  
    57  ENTRYPOINT ["/bin/packer"]
    58  
    59  # Full docker image which can be used to run the binary from a container.
    60  # This image is essentially the same as the `release-light` one, but embeds
    61  # the official plugins in it.
    62  FROM release-light as release-full
    63  
    64  # Install the latest version of the official plugins
    65  RUN /bin/packer plugins install "github.com/hashicorp/amazon" && \
    66      /bin/packer plugins install "github.com/hashicorp/ansible" && \
    67      /bin/packer plugins install "github.com/hashicorp/azure" && \
    68      /bin/packer plugins install "github.com/hashicorp/docker" && \
    69      /bin/packer plugins install "github.com/hashicorp/googlecompute" && \
    70      /bin/packer plugins install "github.com/hashicorp/qemu" && \
    71      /bin/packer plugins install "github.com/hashicorp/vagrant" && \
    72      /bin/packer plugins install "github.com/hashicorp/virtualbox" && \
    73      /bin/packer plugins install "github.com/hashicorp/vmware" && \
    74      /bin/packer plugins install "github.com/hashicorp/vsphere"
    75  
    76  ENTRYPOINT ["/bin/packer"]
    77  
    78  # Set default target to 'dev'.
    79  FROM dev