From 0699e5135ec1e78e2958c2cc8ae1355fae1b02ef Mon Sep 17 00:00:00 2001 From: azlam Date: Sat, 28 Oct 2023 18:47:40 +1100 Subject: [PATCH] feat(ci): add a sfp-lite docker image just containing sfp --- .github/workflows/release.yml | 64 +++++++++++++++--- .../workflows/sfpowerscripts-build-docker.yml | 6 +- dockerfiles/sfp-lite.Dockerfile | 65 +++++++++++++++++++ 3 files changed, 124 insertions(+), 11 deletions(-) create mode 100644 dockerfiles/sfp-lite.Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 168e78355..1888b60d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,6 +53,20 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} token: ${{ secrets.DOCKER_SECRET }} needs: [ build ] + + build-docker-lite: + name: 'build sfp lite docker image' + uses: ./.github/workflows/sfpowerscripts-build-docker.yml + with: + job-environment: 'build-docker' + suffix-tag: ${{ github.run_id }} + repo: 'dxatscale' + dockerFileName: 'sfp-lite' + image: 'sfp-lite-rc' + secrets: + username: ${{ secrets.DOCKER_USERNAME }} + token: ${{ secrets.DOCKER_SECRET }} + needs: [ build ] #Promotion Stages @@ -82,6 +96,19 @@ jobs: token: ${{ secrets.DOCKER_SECRET }} needs: [ build-docker ] + alpha-docker-lite: + name: 'promote docker to alpha' + uses: ./.github/workflows/sfpowerscripts-promote-docker.yml + with: + job-environment: 'sfpowerscripts-alpha-docker' + repo: 'dxatscale' + new-tag: alpha + image: 'sfp-lite-rc' + secrets: + username: ${{ secrets.DOCKER_USERNAME }} + token: ${{ secrets.DOCKER_SECRET }} + needs: [ build-docker ] + sfpowerscripts-beta: name: 'sfpowerscripts beta' @@ -95,6 +122,19 @@ jobs: needs: [ build ] beta-docker: + name: 'promote docker to beta' + uses: ./.github/workflows/sfpowerscripts-promote-docker.yml + with: + job-environment: 'sfpowerscripts-beta-docker' + repo: 'dxatscale' + new-tag: beta + image: 'sfp-lite-rc' + secrets: + username: ${{ secrets.DOCKER_USERNAME }} + token: ${{ secrets.DOCKER_SECRET }} + needs: [ build-docker ] + + beta-docker-lite: name: 'promote docker to beta' uses: ./.github/workflows/sfpowerscripts-promote-docker.yml with: @@ -107,6 +147,7 @@ jobs: token: ${{ secrets.DOCKER_SECRET }} needs: [ build-docker ] + sfpowerscripts-prod: @@ -120,19 +161,20 @@ jobs: npm-token: ${{ secrets.NPM_TOKEN }} needs: [ build ] - sfp-prod: - name: 'sfp prod' - uses: ./.github/workflows/promotePackage.yml + prod-docker: + name: 'copy rc docker to prod' + uses: ./.github/workflows/sfpowerscripts-copy-docker.yml with: - version: 'latest' - pathToPackageJson: 'packages/sfp-cli/package.json' - environment: sfp-prod + job-environment: 'sfpowerscripts-prod-docker' secrets: - npm-token: ${{ secrets.NPM_TOKEN }} - needs: [ build ] + username: ${{ secrets.DOCKER_USERNAME }} + token: ${{ secrets.DOCKER_SECRET }} + signing_secret: ${{ secrets.SIGNING_SECRET }} + cosign_password: ${{ secrets.COSIGN_PASSWORD }} + needs: [ build-docker ] - prod-docker: - name: 'copy rc docker to prod' + prod-docker-lite: + name: 'copy rc lite docker to prod' uses: ./.github/workflows/sfpowerscripts-copy-docker.yml with: job-environment: 'sfpowerscripts-prod-docker' @@ -141,6 +183,8 @@ jobs: token: ${{ secrets.DOCKER_SECRET }} signing_secret: ${{ secrets.SIGNING_SECRET }} cosign_password: ${{ secrets.COSIGN_PASSWORD }} + image: sfp-lite-rc + image-as: sfp-lite needs: [ build-docker ] diff --git a/.github/workflows/sfpowerscripts-build-docker.yml b/.github/workflows/sfpowerscripts-build-docker.yml index d4770dfe1..7ba97fe1e 100644 --- a/.github/workflows/sfpowerscripts-build-docker.yml +++ b/.github/workflows/sfpowerscripts-build-docker.yml @@ -10,6 +10,10 @@ on: repo: type: string required: true + dockerFileName: + type: string + required: false + default: sfpowerscripts image: type: string required: false @@ -70,7 +74,7 @@ jobs: id: docker_build uses: docker/build-push-action@v2 with: - file: dockerfiles/sfpowerscripts.Dockerfile + file: dockerfiles/${{inputs.dockerFileName}}.Dockerfile context: dockerfiles push: true labels: ${{ steps.meta.outputs.labels }} diff --git a/dockerfiles/sfp-lite.Dockerfile b/dockerfiles/sfp-lite.Dockerfile new file mode 100644 index 000000000..ae9f0fe5f --- /dev/null +++ b/dockerfiles/sfp-lite.Dockerfile @@ -0,0 +1,65 @@ +FROM ubuntu:22.04 + + +ARG SFPOWERSCRIPTS_VERSION=alpha +ARG GIT_COMMIT +ARG NODE_MAJOR=18 + +LABEL org.opencontainers.image.description "sfpowerscripts is a build system for modular development in Salesforce." +LABEL org.opencontainers.image.licenses "MIT" +LABEL org.opencontainers.image.url "https://github.com/dxatscale/sfpowerscripts" +LABEL org.opencontainers.image.documentation "https://docs.dxatscale.io/sfpowerscripts/sfpowerscripts" +LABEL org.opencontainers.image.revision $GIT_COMMIT +LABEL org.opencontainers.image.vendor "DX@Scale" +LABEL org.opencontainers.image.source "https://github.com/dxatscale/sfpowerscripts" +LABEL org.opencontainers.image.title "DX@Scale sfp lite docker image - December 23" + + +ENV DEBIAN_FRONTEND=noninteractive + + +RUN ln -sf bash /bin/sh + + +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get -y install --no-install-recommends \ + git \ + curl \ + sudo \ + jq \ + zip \ + unzip \ + make \ + g++ \ + tzdata \ + && apt-get autoremove --assume-yes \ + && apt-get clean --assume-yes \ + && rm -rf /var/lib/apt/list/* + +# Set timezone to UTC +ENV TZ=UTC +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# install nodejs via nodesource +RUN mkdir -p /etc/apt/keyrings \ + && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ + && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ + && apt-get update \ + && apt-get -y install --no-install-recommends nodejs \ + && apt-get autoremove --assume-yes \ + && apt-get clean --assume-yes \ + && rm -rf /var/lib/apt/list/* + + +# Install sfpowerscripts +RUN npm install --global --omit=dev \ + @dxatscale/sfpowerscripts@${SFPOWERSCRIPTS_VERSION} + +WORKDIR /root + + + +# clear the entrypoint for azure +ENTRYPOINT [] +CMD ["/bin/sh"]