Skip to content

Instantly share code, notes, and snippets.

@ptx96
Created April 27, 2023 12:51
Show Gist options
  • Save ptx96/09ad65c00096d625219cb542dc6bf57e to your computer and use it in GitHub Desktop.
Save ptx96/09ad65c00096d625219cb542dc6bf57e to your computer and use it in GitHub Desktop.
A simple dockerfile for packer with ansible provisioner
FROM alpine:3.17.3 as release-light
ARG PRODUCT_VERSION
# TARGETARCH and TARGETOS are set automatically when --platform is provided.
ARG TARGETOS TARGETARCH
ENV USER=nonroot
ENV GROUP=nonroot
ENV PACKER_VERSION=${PRODUCT_VERSION}/packer_${PRODUCT_VERSION}_${TARGETOS}_${TARGETARCH}.zip
RUN apk add --no-cache -U -u \
ca-certificates \
curl \
git \
bash \
wget \
openssl \
gnupg \
xorriso \
ansible
RUN curl -L -o /tmp/packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION} && \
unzip /tmp/packer.zip -d /usr/local/bin && \
rm -rf /tmp/packer.zip
RUN addgroup -g 1000 -S ${GROUP} && \
adduser -u 1000 -D -S -G ${USER} ${GROUP}
USER ${USER}
ENTRYPOINT ["/bin/sh", "-c"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment