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

Update Dockerfile for grub2disk: #147

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
13 changes: 7 additions & 6 deletions grub2disk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
FROM golang:1.23-alpine AS base

FROM base AS build-amd64
RUN apk add --no-cache grub grub-bios git ca-certificates gcc musl-dev

FROM base AS build-arm64
RUN apk add --no-cache grub git ca-certificates gcc musl-dev

FROM build-${TARGETARCH} AS grub2disk
WORKDIR /src
COPY go.mod go.sum /src/
Expand All @@ -15,4 +9,11 @@ RUN CGO_ENABLED=1 GOOS=linux go build -a -ldflags "-linkmode external -extldflag

FROM alpine:3.20.2
COPY --from=grub2disk /src/grub2disk/grub2disk /usr/sbin/grub2disk

FROM base AS build-amd64
RUN apk add --no-cache grub grub-bios git ca-certificates gcc musl-dev

FROM base AS build-arm64
RUN apk add --no-cache grub git ca-certificates gcc musl-dev
Comment on lines +13 to +17
Copy link

@masteinhauser masteinhauser Sep 26, 2024

Choose a reason for hiding this comment

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

I ran into this same issue when trying to fix an EFI grub installation issue for Ubuntu 22.04. Adding a suggestion here, as feedback given in the PR conversation as possible path forward.

Suggested change
FROM base AS build-amd64
RUN apk add --no-cache grub grub-bios git ca-certificates gcc musl-dev
FROM base AS build-arm64
RUN apk add --no-cache grub git ca-certificates gcc musl-dev
FROM base AS build-${TARGETARCH}
RUN apk add --no-cache grub git ca-certificates gcc musl-dev && \
if [ $TARGETARCH = "amd64" ]; then \
apk add --no-cache grub-bios \
; fi


ENTRYPOINT ["/usr/sbin/grub2disk"]