Skip to content

Commit

Permalink
Merge pull request #110 from deepfence/tomasz/arm64
Browse files Browse the repository at this point in the history
[arm64] arch aware docker build
  • Loading branch information
tomaszjonak authored Nov 8, 2023
2 parents 181b58f + 35740ea commit 89c7db1
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
ARG DF_IMG_TAG=latest
ARG IMAGE_REPOSITORY=deepfenceio
FROM $IMAGE_REPOSITORY/deepfence_vectorscan_build:$DF_IMG_TAG AS vectorscan

FROM golang:1.20-alpine3.18 AS builder
MAINTAINER DeepFence

RUN apk update \
&& apk add --upgrade gcc musl-dev pkgconfig g++ make git \
&& apk add hyperscan-dev --repository=https://dl-cdn.alpinelinux.org/alpine/v3.13/community
ENV PKG_CONFIG_PATH=/usr/local/include/hs/ \
CGO_CFLAGS="-I/usr/local/include/hyperscan/src" \
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/include/hs/lib:$LD_LIBRARY_PATH
&& apk add --upgrade gcc musl-dev pkgconfig g++ make git

COPY --from=vectorscan /vectorscan.tar.bz2 /
RUN tar -xjf /vectorscan.tar.bz2 -C / && rm /vectorscan.tar.bz2

WORKDIR /home/deepfence/src/SecretScanner
COPY . .
Expand All @@ -19,13 +22,24 @@ LABEL deepfence.role=system

ENV MGMT_CONSOLE_URL=deepfence-internal-router \
MGMT_CONSOLE_PORT=443
RUN apk update && apk add --no-cache --upgrade curl tar libstdc++ libgcc docker skopeo bash podman \
&& apk add hyperscan --repository=https://dl-cdn.alpinelinux.org/alpine/v3.13/community \
&& nerdctl_version=1.4.0 \
&& curl -fsSLOk https://github.com/containerd/nerdctl/releases/download/v${nerdctl_version}/nerdctl-${nerdctl_version}-linux-amd64.tar.gz \
&& tar Cxzvvf /usr/local/bin nerdctl-${nerdctl_version}-linux-amd64.tar.gz \
&& rm nerdctl-${nerdctl_version}-linux-amd64.tar.gz \
&& apk del curl

ARG TARGETARCH

RUN apk add --no-cache --upgrade tar libstdc++ libgcc docker skopeo bash podman

RUN <<EOF
set -eux

apk update && apk add --no-cache --upgrade curl

NERDCTL_VERSION=1.4.0
curl -fsSLO https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-${TARGETARCH}.tar.gz
tar Cxzvvf /usr/local/bin nerdctl-${NERDCTL_VERSION}-linux-${TARGETARCH}.tar.gz
rm nerdctl-${NERDCTL_VERSION}-linux-${TARGETARCH}.tar.gz

apk del curl
EOF

WORKDIR /home/deepfence/usr
COPY --from=builder /home/deepfence/src/SecretScanner/SecretScanner .
COPY --from=builder /home/deepfence/src/SecretScanner/config.yaml .
Expand Down

0 comments on commit 89c7db1

Please sign in to comment.