Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion build/controlplane.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ RUN mkdir bin
RUN GOEXPERIMENT=jsonv2 go build -mod vendor -o bin ./cmd/controlplane

FROM alpine:3.23
RUN apk add --no-cache ca-certificates
RUN apk add --no-cache ca-certificates musl-locales musl-locales-lang
# we deal with files and we just want to make sure that no strange shit
# happens because LANG does not support utf8
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
WORKDIR /bin
COPY --from=builder /build/bin/controlplane controlplane
ENTRYPOINT ["/bin/controlplane"]
14 changes: 11 additions & 3 deletions internal/tarhelper/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"os"
"path/filepath"
"strings"

"golang.org/x/text/unicode/norm"
)

func TarFiles(rootDir string, files []*os.File, dest string) error {
Expand All @@ -52,11 +54,17 @@ func TarFiles(rootDir string, files []*os.File, dest string) error {
"",
)

// force nfc file names, because if the tar file was created on some oses, macos for example,
// untarring on linux will create bogus file names.
filename := norm.NFC.String(
// TarFiles will also be called on windows, so we need to adjust the paths
filepath.ToSlash(name),
)

if err := tw.WriteHeader(&tar.Header{
Typeflag: tar.TypeReg,
// TarFiles will also be called in windows, so we need to adjust the paths
Name: filepath.ToSlash(name),
Size: info.Size(),
Name: filename,
Size: info.Size(),
}); err != nil {
return fmt.Errorf("tar header: %w", err)
}
Expand Down