Skip to content

Commit

Permalink
Merge pull request #40 from spectrocloud/fips-static-link-fix-main
Browse files Browse the repository at this point in the history
Fips changes for Static Linking
  • Loading branch information
zulfilee authored Jun 27, 2023
2 parents 403b11b + 8132e5e commit 49a9816
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/spectro-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
uses: mukunku/[email protected]
id: checkTag
with:
tag: spectro-v${{ github.event.inputs.release_version }}
tag: v${{ github.event.inputs.release_version }}-spectro
-
if: ${{ steps.checkTag.outputs.exists == 'true' }}
run: |
echo "Tag already exists for spectro-v${{ github.event.inputs.release_version }}..."
echo "Tag already exists for v${{ github.event.inputs.release_version }}-spectro..."
exit 1
-
uses: actions/checkout@v3
Expand Down Expand Up @@ -60,9 +60,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: spectro-v${{ github.event.inputs.release_version }}
release_name: Release spectro-v${{ github.event.inputs.release_version }}
tag_name: v${{ github.event.inputs.release_version }}-spectro
release_name: Release v${{ github.event.inputs.release_version }}-spectro
body: |
Release version ${{ github.event.inputs.release_version }}
Release version v${{ github.event.inputs.release_version }}-spectro
draft: false
prerelease: false
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Build the manager binary
FROM golang:1.19.8 as builder
FROM golang:1.19.10-alpine3.18 as builder

# FIPS
ARG CRYPTO_LIB
ENV GOEXPERIMENT=${CRYPTO_LIB:+boringcrypto}

WORKDIR /workspace
RUN apk update
RUN apk add git gcc g++ curl

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
Expand All @@ -19,6 +22,14 @@ COPY . .
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "${LDFLAGS} -extldflags '-static'" -a -o manager main.go

RUN if [ ${CRYPTO_LIB} ]; \
then \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "${LDFLAGS} -linkmode=external -extldflags '-static'" -a -o manager main.go ;\
else \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "${LDFLAGS} -extldflags '-static'" -a -o manager main.go ;\
fi


# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
#FROM gcr.io/distroless/static:latest
Expand Down

0 comments on commit 49a9816

Please sign in to comment.