-
-
Notifications
You must be signed in to change notification settings - Fork 206
Add alpine go 1.21 image #1920
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
Draft
bandhan-majumder
wants to merge
2
commits into
CycloneDX:master
Choose a base branch
from
bandhan-majumder:feature/alpine-go-121
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add alpine go 1.21 image #1920
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Base-image | ||
FROM golang:1.21-alpine AS base | ||
|
||
ENV PATH=${PATH}:/usr/local/bin | ||
|
||
RUN apk update && apk add --no-cache \ | ||
nodejs \ | ||
npm \ | ||
&& npm install -g corepack \ | ||
&& node -v \ | ||
&& npm -v \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
# cdxgen-image | ||
FROM base AS cdxgen | ||
|
||
LABEL maintainer="CycloneDX" \ | ||
org.opencontainers.image.authors="Team AppThreat <[email protected]>" \ | ||
org.opencontainers.image.source="https://github.com/CycloneDX/cdxgen" \ | ||
org.opencontainers.image.url="https://github.com/CycloneDX/cdxgen" \ | ||
org.opencontainers.image.version="rolling" \ | ||
org.opencontainers.image.vendor="CycloneDX" \ | ||
org.opencontainers.image.licenses="Apache-2.0" \ | ||
org.opencontainers.image.title="cdxgen" \ | ||
org.opencontainers.image.description="Rolling image with cdxgen SBOM generator for go apps" \ | ||
org.opencontainers.docker.cmd="docker run --rm -v /tmp:/tmp -p 9090:9090 -v $(pwd):/app:rw -t ghcr.io/cyclonedx/cdxgen-alpine-golang121:v11 -r /app --server" | ||
|
||
ENV CDXGEN_IN_CONTAINER=true \ | ||
NODE_COMPILE_CACHE="/opt/cdxgen-node-cache" \ | ||
PATH=${PATH}:/usr/local/bin:/opt/cdxgen/node_modules/.bin | ||
|
||
COPY . /opt/cdxgen | ||
|
||
RUN cd /opt/cdxgen && corepack enable && corepack pnpm install --config.strict-dep-builds=true --prod --no-optional --package-import-method copy --frozen-lockfile && corepack pnpm cache delete \ | ||
&& npm uninstall -g corepack \ | ||
&& apk del npm \ | ||
&& mkdir -p ${NODE_COMPILE_CACHE} \ | ||
&& node /opt/cdxgen/bin/cdxgen.js --help \ | ||
&& rm -rf /root/.cache/node \ | ||
&& chmod a-w -R /opt | ||
WORKDIR /app | ||
ENTRYPOINT ["node", "/opt/cdxgen/bin/cdxgen.js"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this argument could be templatised with a build-arg and we execute the same Dockerfile a few times with different Go versions? @malice00 any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably can. Might need some tweaking in the workflows & actions and add another parameter or something like that. @bandhan-majumder you want to give it a try, or do you want me to look at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I may need some time as my exams are going on. If there is no urgency of this, I can take a look after some days. Also, the argument will have to templatised in two places I think, in the base image and in the label
org.opencontainers.docker.cmd
. Please correct me if I am wrong.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about urgency on this... Did @prabhu say anything when he gave you the assignment?
@prabhu we can always merge as-is and open a new issue on the templating if you need this image asap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not urgent at all.