This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
78 lines (58 loc) · 2.07 KB
/
Dockerfile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM golang:1.17-alpine as build
ENV CGO_ENABLED=0
RUN apk add --no-cache make \
git
WORKDIR /cuebe
COPY go.mod go.sum ./
RUN go mod download \
&& go mod verify
COPY . .
# Build cuebe
RUN make build
# go install cuelang
RUN go install cuelang.org/go/cmd/[email protected]
#########################################################
# gcloud cli install
FROM docker:19.03.11 as static-docker-source
FROM alpine:3.15.0 as gcloud-sdk-build
ARG CLOUD_SDK_VERSION=434.0.0
ENV CLOUD_SDK_VERSION=${CLOUD_SDK_VERSION}
RUN apk --no-cache add curl
# Will produce /build/google-cloud-sdk to be copied over the docker image layer
RUN mkdir /build
WORKDIR /build
RUN curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz
RUN tar xzf google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
rm google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz
#########################################################
FROM golang:1.17-alpine
# Installing GCP cloud-sdk
ENV PATH /google-cloud-sdk/bin:$PATH
COPY --from=static-docker-source /usr/local/bin/docker /usr/local/bin/docker
COPY --from=gcloud-sdk-build /build/google-cloud-sdk /google-cloud-sdk
# gcloud cli requirements
RUN addgroup -g 1001 -S cloudsdk && \
adduser -u 1001 -S cloudsdk -G cloudsdk
RUN apk --no-cache add \
curl \
python3 \
py3-crcmod \
py3-openssl \
bash \
libc6-compat \
openssh-client \
git \
gnupg
RUN gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true && \
gcloud config set metrics/environment github_docker_image && \
gcloud components install gke-gcloud-auth-plugin && \
gcloud --version
ENV USE_GKE_GCLOUD_AUTH_PLUGIN=True
RUN git config --system credential.'https://source.developers.google.com'.helper gcloud.sh
VOLUME ["/root/.config"]
# Get cuebe bin from the build layer
COPY --from=build /cuebe/bin/cuebe /usr/bin/cuebe
COPY --from=build /go/bin/cue /usr/bin/cue
WORKDIR /go
ENTRYPOINT ["cuebe"]