Skip to content

Commit

Permalink
Merge pull request #32 from smallstep/cloud-only
Browse files Browse the repository at this point in the history
Add job to build docker images without CGO
  • Loading branch information
maraino authored Jan 26, 2023
2 parents 171a23f + 7a2401c commit 7afeaae
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
runs-on: ubuntu-latest
env:
DOCKER_IMAGE: smallstep/step-kms-plugin
DOCKER_IMAGE_CLOUD: smallstep/step-kms-plugin-cloud
outputs:
version: ${{ steps.extract-tag.outputs.VERSION }}
is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
docker_tags: ${{ env.DOCKER_TAGS }}
docker_tags_cloud: ${{ env.DOCKER_TAGS_CLOUD }}
steps:
- name: Is Pre-release
id: is_prerelease
Expand All @@ -36,10 +38,12 @@ jobs:
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=${VERSION}" >> ${GITHUB_OUTPUT}
echo "DOCKER_TAGS=${{ env.DOCKER_IMAGE }}:${VERSION}" >> ${GITHUB_ENV}
echo "DOCKER_TAGS_CLOUD=${{ env.DOCKER_IMAGE_CLOUD }}:${VERSION}" >> ${GITHUB_ENV}
- name: Add Latest Tag
if: steps.is_prerelease.outputs.IS_PRERELEASE == 'false'
run: |
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }},${{ env.DOCKER_IMAGE }}:latest" >> ${GITHUB_ENV}
echo "DOCKER_TAGS_CLOUD=${{ env.DOCKER_TAGS_CLOUD }},${{ env.DOCKER_IMAGE_CLOUD }}:latest" >> ${GITHUB_ENV}
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down Expand Up @@ -79,3 +83,17 @@ jobs:
docker_image: smallstep/step-kms-plugin
docker_file: docker/Dockerfile
secrets: inherit

build_upload_docker_cloud:
name: Build & Upload Cloud Only Docker Images
needs: create_release
permissions:
id-token: write
contents: write
uses: smallstep/workflows/.github/workflows/docker-buildx-push.yml@main
with:
platforms: linux/amd64,linux/arm64
tags: ${{ needs.create_release.outputs.docker_tags_cloud }}
docker_image: smallstep/step-kms-plugin-cloud
docker_file: docker/Dockerfile.cloud
secrets: inherit
15 changes: 15 additions & 0 deletions docker/Dockerfile.cloud
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:alpine AS builder

WORKDIR /src
COPY . .

RUN apk add --no-cache git make
RUN make V=1 CGO_ENABLED=0 build

FROM smallstep/step-cli:latest

COPY --from=builder /src/bin/step-kms-plugin /usr/local/bin/step-kms-plugin

USER step

CMD ["/bin/bash"]

0 comments on commit 7afeaae

Please sign in to comment.