-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Switch to debian and update packages #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,28 +1,84 @@ | ||||||||||||||||
| # syntax=docker/dockerfile:1 | ||||||||||||||||
| FROM ubuntu:25.10 AS base | ||||||||||||||||
|
|
||||||||||||||||
| # Version of actionlint to install: latest, or specific version number WITHOUT 'v' prefix e.g. 1.7.5 | ||||||||||||||||
| ARG ACTIONLINT_VERSION=latest | ||||||||||||||||
| # Version of hadolint to install: latest, or specific version number e.g. v2.14.0 | ||||||||||||||||
| ARG HADOLINT_VERSION=latest | ||||||||||||||||
| # Version of shellcheck to install: latest, or specific version number e.g. v0.11.0 | ||||||||||||||||
| ARG SHELLCHECK_VERSION=latest | ||||||||||||||||
| # Version of shfmt to install: latest, or specific version number e.g. v3.12.0 | ||||||||||||||||
| ARG SHFMT_VERSION=latest | ||||||||||||||||
| # Version of uv to install: latest, or specific version number e.g. v0.9.17 | ||||||||||||||||
| ARG UV_VERSION=latest | ||||||||||||||||
| # Version of reviewdog to install: latest, or specific version number e.g. v0.21.0 | ||||||||||||||||
| ARG REVIEWDOG_VERSION=latest | ||||||||||||||||
| # Version of Snyk to install: stable, latest, or specific version number e.g. v1.1301.1 | ||||||||||||||||
| ARG SNYK_VERSION=stable | ||||||||||||||||
|
|
||||||||||||||||
| # Images which we can directly copy the binaries from | ||||||||||||||||
| FROM rhysd/actionlint:${ACTIONLINT_VERSION} AS actionlint | ||||||||||||||||
| FROM hadolint/hadolint:${HADOLINT_VERSION} AS hadolint | ||||||||||||||||
| FROM koalaman/shellcheck:${SHELLCHECK_VERSION} AS shellcheck | ||||||||||||||||
| FROM mvdan/shfmt:${SHFMT_VERSION} AS shfmt | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| # Using debian as base since it's generally stable, compatible and well supported | ||||||||||||||||
| FROM debian:13 AS base | ||||||||||||||||
|
|
||||||||||||||||
| # Docker built-in arg for multi-platform builds | ||||||||||||||||
| ARG TARGETARCH | ||||||||||||||||
|
|
||||||||||||||||
| # Redeclare args for use in this scope | ||||||||||||||||
| ARG UV_VERSION | ||||||||||||||||
| ARG REVIEWDOG_VERSION | ||||||||||||||||
| ARG SNYK_VERSION | ||||||||||||||||
|
|
||||||||||||||||
| # Environment variables | ||||||||||||||||
| ENV PYTHONDONTWRITEBYTECODE=1 | ||||||||||||||||
| ENV PYTHONUNBUFFERED=1 | ||||||||||||||||
| ENV JAVA_HOME=/usr/lib/jvm/java-openjdk | ||||||||||||||||
| ENV LANG=en_US.UTF-8 | ||||||||||||||||
|
||||||||||||||||
| ENV LANG=en_US.UTF-8 | |
| ENV LANG=C.UTF-8 |
Copilot
AI
Dec 12, 2025
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.
The comment states watchman is "Required for pyre vscode extension" but pyre is not mentioned elsewhere in the Dockerfile. Consider expanding this comment to clarify if pyre is expected to be installed separately by users, or if there are other dependencies on watchman that should be documented.
| # Required for pyre vscode extension | |
| # watchman is required by the Pyre VSCode extension for file watching functionality. | |
| # Note: Pyre itself is not installed by this Dockerfile; users who need Pyre should install it separately. | |
| # Other tools or extensions that rely on watchman may also benefit from its presence. |
Copilot
AI
Dec 12, 2025
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.
The testing repository is temporarily enabled and then disabled using sed. However, the comment on line 58 says packages from testing are "especially those that are difficult to build/install elsewhere" but only watchman is explicitly installed from testing (line 65). Consider documenting which specific packages require the testing repository, as this complex setup may confuse future maintainers who might not understand why this pattern is necessary for a single package.
Copilot
AI
Dec 12, 2025
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.
The OpenJDK version was upgraded from 17 to 21. While this is a positive change to use a newer LTS version, consider adding a comment explaining this upgrade, especially if it's driven by specific requirements or compatibility needs, to help future maintainers understand the decision.
| # Required for sonarqube vscode extension | |
| # Required for sonarqube vscode extension | |
| # Use OpenJDK 21 (latest LTS) instead of 17 to ensure compatibility with modern Java tools and libraries. |
Copilot
AI
Dec 12, 2025
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.
The symlinks for eza, batcat, and fdfind are created assuming these binaries exist at the specified paths. While these should exist after the apt install, consider adding a comment indicating these are Debian-specific binary names that need aliasing, as this may not be obvious to maintainers unfamiliar with Debian package naming conventions.
| # Linking preferred alternatives | |
| # Linking preferred alternatives | |
| # Debian/Ubuntu package some tools under non-standard binary names: | |
| # - 'eza' (better 'ls') is installed as 'eza' | |
| # - 'bat' (better 'cat') is installed as 'batcat' | |
| # - 'fd' (better 'find') is installed as 'fdfind' | |
| # The following symlinks provide the expected command names for these tools. |
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.
It's a good practice to use the -f (--force) flag with ln -s in a Dockerfile to make the command idempotent. If the symlinks already exist for any reason (e.g., from the base image or a previous layer), the build won't fail. This ensures the desired links are in place by overwriting any existing files or links at the destination.
RUN ln -sf /usr/bin/eza /usr/local/bin/ls \
&& ln -sf /usr/bin/batcat /usr/local/bin/bat \
&& ln -sf /usr/bin/fdfind /usr/local/bin/fd \
# Make sure java runtime is found for sonarqube
&& ln -sf "$(dirname "$(dirname "$(readlink -f "$(which java)")")")" "${JAVA_HOME}"
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.
The current method of installing uv by piping curl to sh from a dynamic URL (https://astral.sh/uv/install.sh) poses a security risk from supply chain attacks. This is inconsistent with the more secure methods used for reviewdog (pinning to a commit hash) and snyk (checksum verification). To mitigate this, I recommend adopting a more secure installation pattern. A better approach would be to download the uv binary directly for the target architecture and verify its checksum against a trusted source, similar to how snyk is installed.
Copilot
AI
Dec 12, 2025
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.
The UV_VER variable strips the 'v' prefix but this stripping is unnecessary since the ARG comment on line 11 states the version should be specified "WITHOUT 'v' prefix". Consider removing the "${UV_VERSION#v}" operation and using UV_VERSION directly to match the documented expectation.
Copilot
AI
Dec 12, 2025
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.
Installing uv by piping curl output from astral.sh directly into sh executes remote code as root during the image build without any integrity verification. If the download endpoint, its DNS, or TLS is compromised, an attacker could run arbitrary commands in the build environment and backdoor the resulting uv binary used in CI. Instead, download the installer or binary to disk and verify it against a pinned checksum or signature (or use a package manager/pinned image) before executing it.
Copilot
AI
Dec 12, 2025
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.
The reviewdog installation uses a hardcoded commit hash (fd59714416d6d9a1c0692d872e38e7f8448df4fc) in the URL, which bypasses the REVIEWDOG_VERSION argument declared on line 14. This means users cannot control the reviewdog version through build arguments. Consider using a version-based approach similar to other tools, or if a specific commit is required for stability, add a comment explaining why the version argument is not being used.
| RUN curl -sfL "https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh" \ | |
| RUN REVIEWDOG_INSTALL_REF=$([ "${REVIEWDOG_VERSION}" = "latest" ] && echo "master" || echo "${REVIEWDOG_VERSION}") \ | |
| && curl -sfL "https://raw.githubusercontent.com/reviewdog/reviewdog/${REVIEWDOG_INSTALL_REF}/install.sh" \ |
Copilot
AI
Dec 12, 2025
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.
reviewdog is installed by piping a remote install.sh script from GitHub directly into sh, which again runs unverified third-party code as root during the image build. A compromise of the GitHub repository, raw content delivery, or its dependencies could inject malicious commands or ship a trojanized reviewdog binary that later runs in CI with access to repository data and tokens. Prefer downloading a specific, pinned release asset and verifying its checksum (or vendoring the installer script in this repo) instead of executing it directly from the network.
Copilot
AI
Dec 12, 2025
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.
The command substitution for REVIEWDOG_VERSION uses echo "" when the version is "latest", which results in passing an empty string as an argument to the install script. While this might work, it's cleaner to conditionally omit the entire argument. Additionally, the condition logic is inverted - it provides the version argument when NOT "latest", but the echo statement on success is empty. Consider restructuring to be more explicit about the intended behavior.
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.
The awk '{print $1}' here appears to be redundant. The jq -r ".assets.\"${BINARY_NAME}\".sha256" command should already extract just the SHA256 hash string from the release.json. Removing the unnecessary awk command will make the line cleaner and more direct.
&& SNYK_SHA256=$(echo "${RELEASE_JSON}" | jq -r ".assets.\"${BINARY_NAME}\".sha256") \
Copilot
AI
Dec 12, 2025
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.
The jq command extracts the sha256 value and pipes it through awk to get the first field, but this assumes a specific format in the JSON response. If the sha256 field is already just the hash string (without additional fields), the awk command is redundant. More importantly, if the JSON format is unexpected or the sha256 field is missing, the checksum verification on line 134 could silently pass with an empty string. Consider adding error checking to ensure SNYK_SHA256 is not empty before proceeding with the download and verification.
| && SNYK_SHA256=$(echo "${RELEASE_JSON}" | jq -r ".assets.\"${BINARY_NAME}\".sha256" | awk '{print $1}') \ | |
| && SNYK_SHA256=$(echo "${RELEASE_JSON}" | jq -r ".assets.\"${BINARY_NAME}\".sha256") \ | |
| && if [ -z "${SNYK_SHA256}" ] || [ "${SNYK_SHA256}" = "null" ]; then echo "Error: SNYK_SHA256 is empty or null! Aborting." >&2; exit 1; fi \ |
Copilot
AI
Dec 12, 2025
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.
The Snyk installation retrieves the download URL from a JSON response but doesn't validate that the URL was successfully extracted. If jq fails to find the expected path or returns null, SNYK_URL could be empty or "null", causing the curl command to fail silently or download from an invalid location. Add validation to ensure SNYK_URL is not empty before attempting the download.
| && SNYK_SHA256=$(echo "${RELEASE_JSON}" | jq -r ".assets.\"${BINARY_NAME}\".sha256" | awk '{print $1}') \ | |
| && SNYK_SHA256=$(echo "${RELEASE_JSON}" | jq -r ".assets.\"${BINARY_NAME}\".sha256" | awk '{print $1}') \ | |
| && if [ -z "${SNYK_URL}" ] || [ "${SNYK_URL}" = "null" ]; then echo "Error: Failed to extract Snyk download URL for ${BINARY_NAME}"; exit 1; fi \ |
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.
The base image uses
debian:13, but Debian 13 (Trixie) is currently in testing and not yet released as stable. For production use, consider using the current stable releasedebian:12(Bookworm) instead, or explicitly usedebian:testingif the testing version is intentional. Using an unreleased version number may cause issues when Debian 13 is officially released with potentially different package versions.