mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-11 09:40:17 -04:00
The Docker images release-light and release-full are not to be built locally from a dev build, but from a release, and the commands to build those images are only referenced in CI, so we don't need to ship them as part of the makefile. In addition, those images are not straightforward to build from the Makefile, as they require quite a few things from the environment, as well as the binary installed in a specific location, which is never setup by the rest of the Makefile. Therefore, we opted to simplify the Makefile so that it only builds docker-dev for local use.
76 lines
3.1 KiB
Docker
76 lines
3.1 KiB
Docker
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
# ========================================================================
|
|
#
|
|
# This Dockerfile contains multiple targets.
|
|
# Use 'docker build --target=<name> .' to build one.
|
|
# e.g. `docker build --target=release-light .`
|
|
#
|
|
# All non-dev targets have a PRODUCT_VERSION argument that must be provided
|
|
# via --build-arg=PRODUCT_VERSION=<version> when building.
|
|
# e.g. --build-arg PRODUCT_VERSION=1.11.2
|
|
#
|
|
# For local dev and testing purposes, please build and use the `dev` docker image.
|
|
#
|
|
# ========================================================================
|
|
|
|
|
|
# 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
|
|
|
|
RUN apk add --no-cache git bash openssl ca-certificates
|
|
|
|
COPY bin/packer /bin/packer
|
|
|
|
ENTRYPOINT ["/bin/packer"]
|
|
|
|
# Light docker image which can be used to run the binary from a container.
|
|
# This image builds from the locally generated binary in ./bin/, and from CI-built binaries within CI.
|
|
# 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
|
|
|
|
ARG PRODUCT_VERSION
|
|
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" \
|
|
version=$PRODUCT_VERSION \
|
|
release=$PRODUCT_VERSION \
|
|
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"
|
|
|
|
RUN apk add --no-cache git bash wget openssl gnupg xorriso
|
|
|
|
COPY dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/
|
|
|
|
ENTRYPOINT ["/bin/packer"]
|
|
|
|
# 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"]
|
|
|
|
# Set default target to 'dev'.
|
|
FROM dev
|