-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: add zizmor Docker image #319
Closed
Closed
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6dbc60d
feat: add Dockerfile for zizmor
trallard c8d9cbd
chore: add Docker to dependabot config
trallard 3fcf235
feat: Use pip to install zizmor instead of buiding from scratch
trallard 481a805
Merge branch 'main' into trallard/add-docker-image
trallard 1c3333d
chore: ensure we point to the right zizmor entrypoint
trallard 53d80fa
ci: add Docker build workflow
trallard 80d6751
chore: remove straggling PATH
trallard 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 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 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
woodruffw marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains 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,35 @@ | ||
FROM python:3.12-slim-bookworm AS build | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/woodruffw/zizmor | ||
|
||
# Zizmor version to install (set as an argument to pair with zizmor releases) | ||
ARG ZIZMOR_VERSION | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PIP_NO_CACHE_DIR=1 \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=1 | ||
|
||
# Add Rust to PATH | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
ENV PATH="/root/.local/bin:${PATH}" | ||
|
||
RUN set -eux && \ | ||
apt-get update && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip install uv && \ | ||
uv tool install zizmor=="${ZIZMOR_VERSION}" && \ | ||
which zizmor | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Runtime image | ||
# ------------------------------------------------------------------------------ | ||
|
||
FROM python:3.12-slim-bookworm | ||
|
||
# Copy necessary files from build stage | ||
COPY --from=build /root/.local/bin/zizmor /root/.local/bin/zizmor | ||
|
||
# Set the entrypoint to zizmor | ||
ENTRYPOINT ["/root/.local/bin/zizmor"] |
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.
There might be a bit of a race condition with this, sadly: PyPI's propagation can take a few minutes IME, so running immediately after a
release
might fail due to the index not listing the release yet.I think there are two (easy-ish) options here:
release -> wait-for-pypi -> docker-build
insteaddocker-publish.yml
or similar that can be triggered separately, e.g. by aworkflow_dispatch
with atag:
inputI'd be OK with either of these but a slight preference for (2), especially since we can give it a
cron
trigger that'll do the update automatically π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.
I was initially going for 2-ish, but then I realized the trigger would need to be other than a release tag so that this did not end up running before the PyPI release was ready, so I moved this inside the PyPI workflow, though I completely forgot about the potential delays on the PyPI side.
Let me move this out into a separate workflow again, as in 2) and we can sort out the trigger event (
cron
or something else).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.
Another alternative could be using the built wheels (already uploaded to the artefacts) to install zizmor (thus avoiding any potential delays on the PyPI side of things) so all the workflows would trigger from the same release tag event.
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.
That could work, although in that case we'd need to reimplement the wheel/tag matching, right? I think a separate workflow + trigger is good for now π