-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Dockerfile
79 lines (62 loc) · 3.24 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
# ========================================================================
#
# 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 <[email protected]>" \
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" \
org.opencontainers.image.licenses="BUSL-1.1"
RUN apk add --no-cache git bash wget openssl gnupg xorriso
COPY dist/$TARGETOS/$TARGETARCH/$BIN_NAME /bin/
RUN mkdir -p /usr/share/doc/Packer
COPY LICENSE /usr/share/doc/Packer/LICENSE.txt
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