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 ORAS tool to Linux ImageBuilder images #1311

Merged
merged 3 commits into from
May 25, 2024
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions src/Microsoft.DotNet.ImageBuilder/Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ RUN dotnet restore -r linux-musl-$TARGETARCH ./src/Microsoft.DotNet.ImageBuilder
COPY . ./
RUN dotnet publish -r linux-musl-$TARGETARCH ./src/Microsoft.DotNet.ImageBuilder.csproj --self-contained=true --no-restore -o out

# download oras package tarball
WORKDIR /
RUN oras_version=1.1.0 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue should be logged to determine a way to keep this version up-to-date with new releases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created an issue to track this: #1313

&& wget https://github.com/oras-project/oras/releases/download/v${oras_version}/oras_${oras_version}_linux_${TARGETARCH}.tar.gz -O oras_linux.tar.gz


# build runtime image
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
Expand All @@ -29,4 +34,11 @@ RUN apk add --no-cache \
WORKDIR /image-builder
COPY --from=build-env /image-builder/out ./

# install oras tool
COPY --from=build-env /oras_linux.tar.gz ./
RUN mkdir -p oras-install/ \
&& tar -zxf oras_linux.tar.gz -C oras-install/ \
&& mv oras-install/oras /usr/local/bin/ \
&& rm -rf oras_linux.tar.gz oras-install/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extraction should be done in the build stage above, then we only need one COPY instruction into /usr/local/bin - this reduces the number of layers in the image and lets us cross-build without running the extraction steps under QEMU emulation, or lets us move to a distroless base image in the future (#1060).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with cbb48eb


ENTRYPOINT ["/image-builder/Microsoft.DotNet.ImageBuilder"]
Loading