diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f396a4cd13..eac2ff9c411 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - uses: actions/setup-java@v2 with: java-version: 11 @@ -45,10 +49,11 @@ jobs: - name: Build and publish slim container image # Only run this on repositories in the 'spinnaker' org, not on forks. if: startsWith(github.repository, 'spinnaker/') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile.slim + platforms: linux/amd64,linux/arm64 push: true tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-unvalidated" @@ -58,10 +63,11 @@ jobs: - name: Build and publish ubuntu container image # Only run this on repositories in the 'spinnaker' org, not on forks. if: startsWith(github.repository, 'spinnaker/') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile.ubuntu + platforms: linux/amd64,linux/arm64 push: true tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-unvalidated-ubuntu" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 41d84a9bcf9..4a86f9c25af 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,6 +13,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - uses: actions/setup-java@v2 with: java-version: 11 @@ -28,20 +32,22 @@ jobs: ORG_GRADLE_PROJECT_version: ${{ steps.build_variables.outputs.VERSION }} run: ./gradlew build ${{ steps.build_variables.outputs.REPO }}-web:installDist - name: Build slim container image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile.slim + platforms: linux/amd64,linux/arm64 tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-slim" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-slim" - name: Build ubuntu container image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile.ubuntu + platforms: linux/amd64,linux/arm64 tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-ubuntu" "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-ubuntu" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d54ebe17525..d55fcac60b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,10 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - uses: actions/setup-java@v2 with: java-version: 11 @@ -82,10 +86,11 @@ jobs: - name: Build and publish slim container image # Only run this on repositories in the 'spinnaker' org, not on forks. if: startsWith(github.repository, 'spinnaker/') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile.slim + platforms: linux/amd64,linux/arm64 push: true tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated" @@ -94,10 +99,11 @@ jobs: - name: Build and publish ubuntu container image # Only run this on repositories in the 'spinnaker' org, not on forks. if: startsWith(github.repository, 'spinnaker/') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: context: . file: Dockerfile.ubuntu + platforms: linux/amd64,linux/arm64 push: true tags: | "${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.release_info.outputs.RELEASE_VERSION }}-unvalidated-ubuntu" diff --git a/Dockerfile.slim b/Dockerfile.slim index 77fe88af275..e30a87774dd 100644 --- a/Dockerfile.slim +++ b/Dockerfile.slim @@ -1,5 +1,6 @@ FROM python:3.7-alpine3.16 LABEL maintainer="sig-platform@spinnaker.io" +ARG TARGETARCH # KUBECTL_RELEASE kept one minor version behind latest to maximise compatibility overlap ENV KUBECTL_RELEASE=1.20.6 @@ -26,19 +27,20 @@ RUN pip install --upgrade awscli==${AWS_CLI_VERSION} s3cmd==${AWS_CLI_S3_CMD} py && pip uninstall -y pip # Google cloud SDK -RUN wget -nv https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz \ +RUN [ $TARGETARCH == 'amd64' ] && export GCP_ARCH="x86_64" || export GCP_ARCH="arm" \ + && wget -nv https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ && mkdir -p /opt && cd /opt \ - && tar -xzf /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz \ - && rm /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-x86_64.tar.gz \ + && tar -xzf /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && rm /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ && CLOUDSDK_PYTHON="python3" /opt/google-cloud-sdk/install.sh --usage-reporting=false --bash-completion=false --additional-components app-engine-java app-engine-go \ && rm -rf ~/.config/gcloud \ && rm -rf /opt/google-cloud-sdk/.install/.backup # kubectl + AWS IAM authenticator -RUN wget https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_RELEASE}/bin/linux/amd64/kubectl \ +RUN wget https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_RELEASE}/bin/linux/${TARGETARCH}/kubectl \ && chmod +x kubectl \ && mv ./kubectl /usr/local/bin/kubectl \ - && wget -O aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_AIM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_AIM_AUTHENTICATOR_VERSION}_linux_amd64 \ + && wget -O aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_AIM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_AIM_AUTHENTICATOR_VERSION}_linux_${TARGETARCH} \ && chmod +x ./aws-iam-authenticator \ && mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator\ && ln -sf /usr/local/bin/aws-iam-authenticator /usr/local/bin/heptio-authenticator-aws @@ -53,4 +55,4 @@ RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddr USER spinnaker -CMD ["/opt/clouddriver/bin/clouddriver"] +CMD ["/opt/clouddriver/bin/clouddriver"] \ No newline at end of file diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 45fe0e56dbb..aeb9ef05b58 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -1,28 +1,40 @@ FROM ubuntu:bionic LABEL maintainer="sig-platform@spinnaker.io" +ARG TARGETARCH +ENV GOOGLE_CLOUD_SDK_VERSION=374.0.0 +ENV PATH "$PATH:/opt/google-cloud-sdk/bin/" RUN apt-get update && apt-get install -y curl gnupg && \ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ - echo "deb https://packages.cloud.google.com/apt cloud-sdk-bionic main" > /etc/apt/sources.list.d/cloud-sdk.list && \ + echo "deb https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/cloud-sdk.list && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ openjdk-11-jre-headless \ wget \ - google-cloud-sdk \ - google-cloud-sdk-app-engine-java \ - google-cloud-sdk-app-engine-go \ kubectl \ python-pip \ + python3 \ git \ openssh-client && \ pip install awscli==1.18.152 --upgrade && \ rm -rf ~/.config/gcloud -RUN curl -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.8/2020-04-16/bin/linux/amd64/aws-iam-authenticator && \ +RUN curl -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.8/2020-04-16/bin/linux/${TARGETARCH}/aws-iam-authenticator && \ chmod +x /usr/local/bin/aws-iam-authenticator && \ ln -s /usr/local/bin/aws-iam-authenticator /usr/local/bin/heptio-authenticator-aws +# Google cloud SDK +RUN [ $TARGETARCH == 'amd64' ] && export GCP_ARCH="x86_64" || export GCP_ARCH="arm" \ + && wget -nv https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && mkdir -p /opt && cd /opt \ + && tar -xzf /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && rm /google-cloud-sdk-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GCP_ARCH}.tar.gz \ + && CLOUDSDK_PYTHON="python3" /opt/google-cloud-sdk/install.sh --usage-reporting=false --bash-completion=false --additional-components app-engine-java app-engine-go \ + && rm -rf ~/.config/gcloud \ + && rm -rf /opt/google-cloud-sdk/.install/.backup + + RUN adduser --system --uid 10111 --group spinnaker COPY clouddriver-web/build/install/clouddriver /opt/clouddriver RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins