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
19 changes: 18 additions & 1 deletion linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,26 @@ RUN --mount=type=cache,target=/go/pkg/mod \
# Copy source & build
COPY --link . .

# Build binary:
# -a: force rebuild
# -installsuffix cgo: remove cgo support
# -ldflags="-w -s": omits the DWARF symbol table, symbol table and debug information
# -trimpath: remove all file system paths from the compiled executable
# -o /bin/ryuk: output binary to /bin/ryuk
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go build -ldflags '-s' -o /bin/ryuk
go build \
-a \
-installsuffix cgo \
-ldflags="-w -s" \
-trimpath \
-o /bin/ryuk .

# Compress with UPX (trade-off: smaller size vs startup time)
# Note: UPX is not available for s390x architecture
RUN if [ "$(uname -m)" != "s390x" ]; then \
apk add --no-cache upx && upx --best --lzma /bin/ryuk; \
fi

# -----------------
# Certificates
Expand Down
10 changes: 9 additions & 1 deletion windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ USER ContainerUser

# Copy source & build
COPY . .
RUN go build -v -ldflags "-s" -o /bin/ryuk
# Build binary:
# -a: force rebuild
# -installsuffix cgo: remove cgo support
# -ldflags="-w -s": omits the DWARF symbol table, symbol table and debug information
# -trimpath: remove all file system paths from the compiled executable
# -o /bin/ryuk: output binary to /bin/ryuk
RUN go build -a -installsuffix cgo -ldflags="-w -s" -trimpath -o /bin/ryuk .

# Do not optimise with UPX on Windows, as nanoserver does not have PowerShell to install it

# -----------------
# Distributed Image
Expand Down
Loading