forked from kubescape/kubescape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
60 lines (39 loc) · 1.42 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
VERSION 0.6
ARG DOCKER_BUILD_IMAGE_PREFIX="europe-west1-docker.pkg.dev/simplifield-platform-dev/tools"
ARG GCLOUD_SDK_VERSION="410.0.0"
build-all:
BUILD +kubescape
builder:
FROM golang:1.18-alpine
ARG image_version
ARG client
ENV RELEASE=$image_version
ENV CLIENT=$client
ENV GO111MODULE=
ENV CGO_ENABLED=1
# Install required python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 gcc make git libc-dev binutils-gold cmake pkgconfig && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
WORKDIR /work
COPY . .
# install libgit2
RUN rm -rf git2go && make libgit2
# build kubescape cmd
WORKDIR /work
RUN python build.py
SAVE ARTIFACT /work/build/ubuntu-latest/kubescape
RUN /work/build/ubuntu-latest/kubescape download artifacts -o /work/artifacts
SAVE ARTIFACT /work/artifacts
kubescape:
FROM google/cloud-sdk:${GCLOUD_SDK_VERSION}-alpine
RUN gcloud components install gke-gcloud-auth-plugin && gcloud components install kubectl
RUN addgroup -S ks && adduser -S ks -G ks
COPY +builder/artifacts /home/ks/.kubescape
RUN chown -R ks:ks /home/ks/.kubescape
USER ks
WORKDIR /home/ks
COPY +builder/kubescape /usr/bin/kubescape
ARG DOCKER_BUILD_TAG="dev"
SAVE IMAGE --push $DOCKER_BUILD_IMAGE_PREFIX/sf-kubescape:$DOCKER_BUILD_TAG