2023-03-02 15:37:05 -05:00
# Copyright (c) HashiCorp, Inc.
2023-08-10 18:53:29 -04:00
# SPDX-License-Identifier: BUSL-1.1
2023-03-02 15:37:05 -05:00
2022-02-25 18:56:20 -05:00
# ========================================================================
2023-07-20 15:53:52 -04:00
#
2022-02-25 18:56:20 -05:00
# This Dockerfile contains multiple targets.
# Use 'docker build --target=<name> .' to build one.
# e.g. `docker build --target=release-light .`
#
2023-07-20 15:53:52 -04:00
# All non-dev targets have a PRODUCT_VERSION argument that must be provided
# via --build-arg=PRODUCT_VERSION=<version> when building.
2022-08-17 20:45:26 -04:00
# e.g. --build-arg PRODUCT_VERSION=1.11.2
2022-02-25 18:56:20 -05:00
#
# For local dev and testing purposes, please build and use the `dev` docker image.
#
# ========================================================================
2018-10-24 17:02:36 -04:00
2022-02-25 18:56:20 -05:00
# Development docker image primarily used for development and debugging.
# This image builds from the locally generated binary in ./bin/.
# To generate the local binary, run `make dev`.
FROM docker.mirror.hashicorp.services/alpine:latest as dev
2018-10-24 17:02:36 -04:00
2022-02-25 18:56:20 -05:00
RUN apk add --no-cache git bash openssl ca-certificates
2018-10-24 17:02:36 -04:00
2022-02-25 18:56:20 -05:00
COPY bin/packer /bin/packer
2018-10-24 17:02:36 -04:00
2022-02-25 18:56:20 -05:00
ENTRYPOINT [ "/bin/packer" ]
2018-10-24 17:02:36 -04:00
2022-02-25 18:56:20 -05:00
# Light docker image which can be used to run the binary from a container.
2023-07-20 15:53:52 -04:00
# This image builds from the locally generated binary in ./bin/, and from CI-built binaries within CI.
2022-02-25 18:56:20 -05:00
# To generate the local binary, run `make dev`.
# This image is published to DockerHub under the `light`, `light-$VERSION`, and `latest` tags.
FROM docker.mirror.hashicorp.services/alpine:latest as release-light
2022-08-17 20:45:26 -04:00
ARG PRODUCT_VERSION
2022-02-25 18:56:20 -05:00
ARG BIN_NAME
# TARGETARCH and TARGETOS are set automatically when --platform is provided.
ARG TARGETOS TARGETARCH
LABEL name = "Packer" \
maintainer = "HashiCorp Packer Team <packer@hashicorp.com>" \
vendor = "HashiCorp" \
2022-08-17 20:45:26 -04:00
version = $PRODUCT_VERSION \
release = $PRODUCT_VERSION \
2022-02-25 18:56:20 -05:00
summary = "Packer is a tool for creating identical machine images for multiple platforms from a single source configuration." \
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"
2022-10-25 18:08:19 -04:00
RUN apk add --no-cache git bash wget openssl gnupg xorriso
2022-02-25 18:56:20 -05:00
COPY dist/$TARGETOS /$TARGETARCH /$BIN_NAME /bin/
ENTRYPOINT [ "/bin/packer" ]
2023-07-21 11:39:25 -04:00
# Full docker image which can be used to run the binary from a container.
# This image is essentially the same as the `release-light` one, but embeds
# the official plugins in it.
FROM release-light as release-full
# Install the latest version of the official plugins
RUN /bin/packer plugins install "github.com/hashicorp/amazon" && \
/bin/packer plugins install "github.com/hashicorp/ansible" && \
/bin/packer plugins install "github.com/hashicorp/azure" && \
/bin/packer plugins install "github.com/hashicorp/docker" && \
/bin/packer plugins install "github.com/hashicorp/googlecompute" && \
/bin/packer plugins install "github.com/hashicorp/qemu" && \
/bin/packer plugins install "github.com/hashicorp/vagrant" && \
/bin/packer plugins install "github.com/hashicorp/virtualbox" && \
/bin/packer plugins install "github.com/hashicorp/vmware" && \
/bin/packer plugins install "github.com/hashicorp/vsphere"
ENTRYPOINT [ "/bin/packer" ]
2022-02-25 18:56:20 -05:00
# Set default target to 'dev'.
2022-08-17 20:45:26 -04:00
FROM dev