packer-qemu/image/Dockerfile

38 lines
962 B
Docker

FROM hashicorp/packer:1.6.3
ARG PROXY=""
ENV http_proxy="${PROXY}"
ENV https_proxy="${PROXY}"
ARG USER=packer
ARG GROUP=packer
WORKDIR /packer
RUN apk add --update qemu qemu-system-x86_64 qemu-img \
vim htop util-linux gzip sysfsutils openssh-client \
openssh-keygen sudo ansible sshpass curl
RUN addgroup -g 1000 "${GROUP}" && \
adduser -u 1000 -D -G "${GROUP}" "${USER}" && \
adduser "${USER}" qemu && \
echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER && \
chmod 0440 /etc/sudoers.d/$USER
# setup mitogen to enhance ansible speed
ENV MITOGEN_VERSION="0.2.9"
RUN wget https://networkgenomics.com/try/mitogen-${MITOGEN_VERSION}.tar.gz && \
tar xvf mitogen-${MITOGEN_VERSION}.tar.gz && \
mv mitogen-${MITOGEN_VERSION} /mitogen && \
rm mitogen-${MITOGEN_VERSION}.tar.gz
USER "${USER}"
ENV PACKER_LOG=1
ENV PACKER_CACHE_DIR=/packer-cache
ENV PS1="[\u@\h \W]# "
ENTRYPOINT ["/packer/run-packer.sh"]