forked from opendatahub-io/modelmesh-serving
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.develop
87 lines (80 loc) · 3.6 KB
/
Dockerfile.develop
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
79
80
81
82
83
84
85
86
87
# Copyright 2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
# Create the develop, test, and build environment
###############################################################################
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
ARG GOLANG_VERSION=1.18.9
ARG OPENSHIFT_VERSION=4.9
ARG KUSTOMIZE_VERSION=4.5.2
ARG KUBEBUILDER_VERSION=v3.3.0
ARG CONTROLLER_GEN_VERSION=v0.8.0
ENV PATH=/usr/local/go/bin:$PATH:/usr/local/kubebuilder/bin:
USER root
WORKDIR /workspace
# Copy the Go Modules manifests
COPY .pre-commit-config.yaml go.mod go.sum ./
# Install gcc
RUN microdnf install \
diffutils \
gcc-c++ \
make \
wget \
tar \
vim \
git \
findutils \
python38 \
nodejs && \
pip3 install pre-commit && \
# Install go
set -eux; \
wget -qO go.tgz "https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"; \
# sha256sum *go.tgz; \
tar -C /usr/local -xzf go.tgz; \
go version && rm go.tgz && \
# Download and initialize the pre-commit environments before copying the source so they will be cached
git init && \
pre-commit install-hooks && \
rm -rf .git && \
# Download kubebuilder
true \
# First download and extract older dist of kubebuilder which includes required etcd, kube-apiserver and kubectl binaries
&& curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_linux_amd64.tar.gz | tar -xz -C /tmp/ \
&& mv /tmp/kubebuilder_*_linux_amd64 /usr/local/kubebuilder \
# Then download and overwrite kubebuilder binary with desired/latest version
&& curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/${KUBEBUILDER_VERSION}/kubebuilder_linux_amd64 -o /usr/local/kubebuilder/bin/kubebuilder \
&& true && \
# download openshift-cli
curl -sSLf --output /tmp/oc_client.tar.gz https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-${OPENSHIFT_VERSION}/openshift-client-linux.tar.gz \
&& tar -xvf /tmp/oc_client.tar.gz -C /tmp \
&& mv /tmp/oc /usr/local/bin \
&& mv /tmp/kubectl /usr/local/bin \
&& chmod a+x /usr/local/bin/oc /usr/local/bin/kubectl \
&& rm -f /tmp/oc_client.tar.gz && \
# download kustomize
curl -sSLf --output /tmp/kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz \
&& tar -xvf /tmp/kustomize.tar.gz -C /tmp \
&& mv /tmp/kustomize /usr/local/bin \
&& chmod a+x /usr/local/bin/kustomize \
&& rm -v /tmp/kustomize.tar.gz && \
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
go mod download && \
# Install controller-gen
mkdir /tmp/controller-gen-tmp && cd /tmp/controller-gen-tmp \
&& go mod init tmp && go get sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION} \
&& rm -rf /tmp/controller-gen-tmp
RUN go install github.com/onsi/ginkgo/v2/ginkgo
ENV PATH=/root/go/bin/:$PATH