Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add job to build docker images without CGO #32

Merged
merged 3 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]