From 907b8032f2e2b4b9573c68a4cfbc67d51656de4b Mon Sep 17 00:00:00 2001 From: Alex Haiut Date: Sun, 16 Jan 2022 12:00:16 +0200 Subject: [PATCH] modified Dockerfile to work for both amd64 (Intel) and arm64 (M1) --- Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5f831ed1b..71d412184 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-slim AS site-build +FROM node:14 AS site-build WORKDIR /app/ui-build @@ -9,11 +9,12 @@ COPY ui . RUN npm run build -FROM golang:1.16-alpine AS builder +FROM golang:1.17-alpine AS builder # Set necessary environment variables needed for our image. -ENV CGO_ENABLED=1 GOOS=linux GOARCH=amd64 +#ENV CGO_ENABLED=1 GOOS=linux GOARCH=amd64 +ENV CGO_ENABLED=1 GOOS=linux -RUN apk add libpcap-dev gcc g++ make bash perl-utils +RUN apk add --no-cache musl-dev libpcap-dev go gcc g++ make bash perl-utils openssl # Move to agent working directory (/agent-build). WORKDIR /app/agent-build @@ -22,8 +23,8 @@ 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.* ../tap/api/ -RUN go mod download -# cheap trick to make the build faster (As long as go.mod wasn't changes) +RUN go mod download -x +# 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 ARG COMMIT_HASH