mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-05-06 17:27:24 +00:00
* modified Dockerfile to work for both amd64 (Intel) and arm64 (M1) * added changelog * Update `Dockerfile` to have `ARCH` build argument * Remove `docs/CHANGES.md` * Upgrade the Basenine version from `v0.3.0` to `v0.4.6` * Update `publish.yml` to have `ARCH` build argument * Switch `BasenineImageRepo` to Docker Hub * Have separate build arguments for `ARCH` and `GOARCH` * Upgrade the Basenine version from `v0.4.6` to `v0.4.10` * Oops forgot to update the 10th duplicated shell script * Fix the oopsie and reduce duplications * Fix `Dockerfile` * Fix the incompatibility issue between Go plugins and gold linker in Alpine inside `Dockerfile` * Fix `asm: xxhash_amd64.s:120: when dynamic linking, R15 is clobbered by a global variable access` error * Update `Dockerfile` to have cross-compilation on an AMD64 machine Also revert changes in the shell scripts * Delete `debug.Dockerfile` * Create a custom base (`debian:buster-slim` based) image for the shipped image * Replace `mertyildiran/debian-pcap` with `up9inc/debian-pcap` * Upgrade Basenine version to `v0.4.12` * Use `debian:stable-slim` as the base * Fix the indentation in the `Dockerfile` * Update `publish.yml` * Enable `publish.yml` for `feature/multiarch_build` branch * Tag correctly and set `ARCH` Docker argument * Remove the lines that are forgotten to be removed from the shell scripts * Add `MizuAgentImageRepo` constant and use it as default `AgentImage` value * Bring back `Set up Cloud SDK` step to `Build the CLI and publish` job * Build ARM64 CLI for Linux as well * Revert "Enable `publish.yml` for `feature/multiarch_build` branch" This reverts commitd30be4c1f0. * Revert Go 1.17 upgrade * Remove `build_extensions_debug.sh` as well * Make the `Dockerfile` to compile the agent statically * Statically link the protocol extensions * Fix `Dockerfile` * Bring back `-s -w` flags * Verify the signatures of the downloads in `dockcross/linux-arm64-musl` * Revert modifications in some shell scripts * Make the `BUILDARCH` and `TARGETARCH` separation in the `Dockerfile` * Separate cross-compilation builder image into a separate repo named `up9inc/linux-arm64-musl-go-libpcap` * Fill the shell script and specify the tag for `dockcross/linux-arm64-musl` * Remove the unnecessary dependencies from `builder-native-base` * Improve the comments in the `Dockerfile` * Upgrade Basenine version to `v0.4.13` * Fix `Dockerfile` * Revert "Revert "Enable `publish.yml` for `feature/multiarch_build` branch"" This reverts commit303e466bdc. * Revert "Revert "Revert "Enable `publish.yml` for `feature/multiarch_build` branch""" This reverts commit0fe252bbdb. * Remove `push-docker-debug` from the `Makefile` * Rename `publish.yml` to `release.yml` Co-authored-by: Alex Haiut <alex@up9.com>
97 lines
2.8 KiB
Docker
97 lines
2.8 KiB
Docker
ARG BUILDARCH=amd64
|
|
ARG TARGETARCH=amd64
|
|
|
|
### Front-end
|
|
FROM node:16 AS front-end
|
|
|
|
WORKDIR /app/ui-build
|
|
|
|
COPY ui/package.json .
|
|
COPY ui/package-lock.json .
|
|
RUN npm i
|
|
COPY ui .
|
|
RUN npm run build
|
|
RUN npm run build-ent
|
|
|
|
### Base builder image for native builds architecture
|
|
FROM golang:1.16-alpine AS builder-native-base
|
|
ENV CGO_ENABLED=1 GOOS=linux
|
|
RUN apk add libpcap-dev g++
|
|
|
|
|
|
### Intermediate builder image for x86-64 to x86-64 native builds
|
|
FROM builder-native-base AS builder-from-amd64-to-amd64
|
|
ENV GOARCH=amd64
|
|
|
|
|
|
### Intermediate builder image for AArch64 to AArch64 native builds
|
|
FROM builder-native-base AS builder-from-arm64v8-to-arm64v8
|
|
ENV GOARCH=arm64
|
|
|
|
|
|
### Builder image for x86-64 to AArch64 cross-compilation
|
|
FROM up9inc/linux-arm64-musl-go-libpcap AS builder-from-amd64-to-arm64v8
|
|
ENV CGO_ENABLED=1 GOOS=linux
|
|
ENV GOARCH=arm64 CGO_CFLAGS="-I/work/libpcap"
|
|
|
|
|
|
### Final builder image where the build happens
|
|
# Possible build strategies:
|
|
# BUILDARCH=amd64 TARGETARCH=amd64
|
|
# BUILDARCH=arm64v8 TARGETARCH=arm64v8
|
|
# BUILDARCH=amd64 TARGETARCH=arm64v8
|
|
ARG BUILDARCH=amd64
|
|
ARG TARGETARCH=amd64
|
|
FROM builder-from-${BUILDARCH}-to-${TARGETARCH} AS builder
|
|
|
|
# Move to agent working directory (/agent-build)
|
|
WORKDIR /app/agent-build
|
|
|
|
COPY agent/go.mod agent/go.sum ./
|
|
COPY shared/go.mod shared/go.mod ../shared/
|
|
COPY tap/go.mod tap/go.mod ../tap/
|
|
COPY tap/api/go.mod ../tap/api/
|
|
COPY tap/extensions/amqp/go.mod ../tap/extensions/amqp/
|
|
COPY tap/extensions/http/go.mod ../tap/extensions/http/
|
|
COPY tap/extensions/kafka/go.mod ../tap/extensions/kafka/
|
|
COPY tap/extensions/redis/go.mod ../tap/extensions/redis/
|
|
RUN go mod download
|
|
# cheap trick to make the build faster (as long as go.mod did not change)
|
|
RUN go list -f '{{.Path}}@{{.Version}}' -m all | sed 1d | grep -e 'go-cache' | xargs go get
|
|
|
|
# Copy and build agent code
|
|
COPY shared ../shared
|
|
COPY tap ../tap
|
|
COPY agent .
|
|
|
|
ARG COMMIT_HASH
|
|
ARG GIT_BRANCH
|
|
ARG BUILD_TIMESTAMP
|
|
ARG SEM_VER=0.0.0
|
|
|
|
WORKDIR /app/agent-build
|
|
|
|
RUN go build -ldflags="-extldflags=-static -s -w \
|
|
-X 'mizuserver/pkg/version.GitCommitHash=${COMMIT_HASH}' \
|
|
-X 'mizuserver/pkg/version.Branch=${GIT_BRANCH}' \
|
|
-X 'mizuserver/pkg/version.BuildTimestamp=${BUILD_TIMESTAMP}' \
|
|
-X 'mizuserver/pkg/version.SemVer=${SEM_VER}'" -o mizuagent .
|
|
|
|
|
|
### The shipped image
|
|
ARG TARGETARCH=amd64
|
|
FROM ${TARGETARCH}/busybox:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy binary and config files from /build to root folder of scratch container.
|
|
COPY --from=builder ["/app/agent-build/mizuagent", "."]
|
|
COPY --from=front-end ["/app/ui-build/build", "site"]
|
|
COPY --from=front-end ["/app/ui-build/build-ent", "site-standalone"]
|
|
|
|
# gin-gonic runs in debug mode without this
|
|
ENV GIN_MODE=release
|
|
|
|
# this script runs both apiserver and passivetapper and exits either if one of them exits, preventing a scenario where the container runs without one process
|
|
ENTRYPOINT "/app/mizuagent"
|