Skip to content

Commit

Permalink
OP-21899 Packer fixed - Replaced init with plugins install (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-agrawal authored Mar 13, 2024
1 parent b19c51e commit a82eb4e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
12 changes: 11 additions & 1 deletion docker/ubi8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ WORKDIR /packer
RUN yum install -y java-17-openjdk-devel wget unzip curl tar git openssl curl net-tools nettle && \
wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip && \
unzip packer_${PACKER_VERSION}_linux_amd64.zip && \
packer init . && \
rm packer_${PACKER_VERSION}_linux_amd64.zip

RUN yum -y update
Expand All @@ -39,4 +38,15 @@ ENV PATH "kustomize:$PATH"
RUN useradd spinnaker
RUN mkdir -p /opt/rosco/plugins
USER spinnaker

# Install packer plugins (must be run as spinnaker user). To provide a github token (optional), run docker build with something like "--secret id=github_token,env=PACKER_GITHUB_API_TOKEN"
ARG PACKER_PLUGINS="amazon azure googlecompute"
RUN for plugin in $PACKER_PLUGINS ; do \
if [ -f /run/secrets/github_token ]; then \
PACKER_GITHUB_API_TOKEN=$(cat /run/secrets/github_token) packer plugins install "github.com/hashicorp/$plugin"; \
else \
packer plugins install "github.com/hashicorp/$plugin"; \
fi; \
done

CMD ["/opt/rosco/bin/rosco"]
16 changes: 11 additions & 5 deletions docker/ubi8/Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ ENV PACKER_VERSION=1.10.1

WORKDIR /packer



RUN yum install -y java-17-openjdk-devel wget unzip curl tar git openssl net-tools nettle && \
wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip && \
unzip packer_${PACKER_VERSION}_linux_amd64.zip && \
packer init . && \
rm packer_${PACKER_VERSION}_linux_amd64.zip



ENV PATH "/packer:$PATH"

Expand Down Expand Up @@ -94,4 +89,15 @@ RUN mv Armory.armory-observability-plugin-${CUSTOMPLUGIN_RELEASEVERSION}-SNAPSHO
RUN chmod -R 777 /opt/rosco/plugins/
RUN chown -R spinnaker:spinnaker /opt/
USER spinnaker

# Install packer plugins (must be run as spinnaker user). To provide a github token (optional), run docker build with something like "--secret id=github_token,env=PACKER_GITHUB_API_TOKEN"
ARG PACKER_PLUGINS="amazon azure googlecompute"
RUN for plugin in $PACKER_PLUGINS ; do \
if [ -f /run/secrets/github_token ]; then \
PACKER_GITHUB_API_TOKEN=$(cat /run/secrets/github_token) packer plugins install "github.com/hashicorp/$plugin"; \
else \
packer plugins install "github.com/hashicorp/$plugin"; \
fi; \
done

CMD ["/opt/rosco/bin/rosco"]
17 changes: 11 additions & 6 deletions docker/ubi8/Dockerfile-fips
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,12 @@ COPY halconfig/packer /opt/rosco/config/packer
ENV KUSTOMIZE_VERSION=5.0.3

ENV PACKER_VERSION=1.10.1

WORKDIR /packer



RUN yum install -y java-17-openjdk-devel wget unzip curl tar git openssl net-tools nettle && \
wget https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip && \
unzip packer_${PACKER_VERSION}_linux_amd64.zip && \
packer init . && \
rm packer_${PACKER_VERSION}_linux_amd64.zip



ENV PATH "/packer:$PATH"

Expand Down Expand Up @@ -92,4 +86,15 @@ RUN chmod -R 777 /opt/rosco/plugins/
RUN chown -R spinnaker:spinnaker /opt/
RUN yum -y remove tar vim vi
USER spinnaker

# Install packer plugins (must be run as spinnaker user). To provide a github token (optional), run docker build with something like "--secret id=github_token,env=PACKER_GITHUB_API_TOKEN"
ARG PACKER_PLUGINS="amazon azure googlecompute"
RUN for plugin in $PACKER_PLUGINS ; do \
if [ -f /run/secrets/github_token ]; then \
PACKER_GITHUB_API_TOKEN=$(cat /run/secrets/github_token) packer plugins install "github.com/hashicorp/$plugin"; \
else \
packer plugins install "github.com/hashicorp/$plugin"; \
fi; \
done

CMD ["/opt/rosco/bin/rosco"]

0 comments on commit a82eb4e

Please sign in to comment.