Skip to content

Commit 94c1e04

Browse files
authored
Merge pull request #1330 from yue9944882/base-image
Provide base images for saving installation time
2 parents b6d3250 + 037b0db commit 94c1e04

File tree

7 files changed

+79
-6
lines changed

7 files changed

+79
-6
lines changed

client-java-contrib/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ RUN apk add --no-cache git bash && \
88
chmod +x /usr/bin/kubectl && \
99
git clone https://github.com/kubernetes-client/gen.git
1010

11+
COPY Dockerfile.gen gen/openapi/openapi-generator/Dockerfile
1112
COPY generate.sh generate.sh
13+
1214
RUN chmod +x generate.sh
1315

1416
WORKDIR gen/openapi

client-java-contrib/Dockerfile.gen

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM ghcr.io/yue9944882/crd-model-gen-base:v1.0.0
2+
# TODO: move this to kubernetes-client group after the permission issue fixed
3+
4+
ARG OPENAPI_GENERATOR_COMMIT
5+
ARG GENERATION_XML_FILE
6+
ARG OPENAPI_GENERATOR_USER_ORG=OpenAPITools
7+
8+
# Copy required files
9+
COPY openapi-generator/generate_client_in_container.sh /generate_client.sh
10+
COPY preprocess_spec.py /
11+
COPY custom_objects_spec.json /
12+
COPY ${GENERATION_XML_FILE} /generation_params.xml
13+
14+
ENTRYPOINT ["mvn-entrypoint.sh", "/generate_client.sh"]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM maven:3.5-jdk-8-slim
2+
3+
# Install preprocessing script requirements
4+
RUN apt-get update && apt-get -y install git python-pip && pip install urllib3==1.24.2
5+
6+
# Install Autorest
7+
RUN apt-get update && apt-get -qq -y install libunwind8 libicu57 libssl1.0 liblttng-ust0 libcurl3 libuuid1 libkrb5-3 zlib1g gnupg2
8+
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
9+
RUN apt-get update && apt-get -y install \
10+
nodejs \
11+
libunwind8-dev \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
RUN npm install -g autorest@3
15+
16+
# Check out specific commit of openapi-generator
17+
RUN mkdir /source && \
18+
cd /source && \
19+
git clone -n https://github.com/${OPENAPI_GENERATOR_USER_ORG}/openapi-generator.git && \
20+
cd openapi-generator && \
21+
git checkout $OPENAPI_GENERATOR_COMMIT
22+
23+
# Build it and persist local repository
24+
RUN mkdir /.npm && chmod -R go+rwx /.npm && chmod -R go+rwx /root && umask 0 && cd /source/openapi-generator && \
25+
mvn install -DskipTests -Dmaven.test.skip=true -pl modules/openapi-generator-maven-plugin -am && \
26+
cp -r /root/.m2/* /usr/share/maven/ref
27+
28+
RUN mkdir -p /node_modules && chmod -R go+rwx /node_modules
29+
RUN npm install @microsoft.azure/autorest.csharp \
30+
@microsoft.azure/autorest.modeler
31+
32+
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
33+
RUN mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
34+
RUN curl https://packages.microsoft.com/config/debian/9/prod.list > prod.list
35+
RUN mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
36+
RUN chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
37+
RUN chown root:root /etc/apt/sources.list.d/microsoft-prod.list
38+
39+
RUN apt-get update
40+
RUN apt-get install -yy -q dotnet-hosting-2.0.8

client-java-contrib/cert-manager/update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# under src/main/java/io/cert/manager/models.
1818

1919
DEFAULT_IMAGE_NAME=docker.pkg.github.com/kubernetes-client/java/crd-model-gen
20-
DEFAULT_IMAGE_TAG=v1.0.2
20+
DEFAULT_IMAGE_TAG=v1.0.3
2121
IMAGE_NAME=${IMAGE_NAME:=$DEFAULT_IMAGE_NAME}
2222
IMAGE_TAG=${IMAGE_TAG:=$DEFAULT_IMAGE_TAG}
2323

@@ -34,4 +34,4 @@ docker run \
3434
-u https://github.com/jetstack/cert-manager/releases/download/v0.16.1/cert-manager.crds.yaml \
3535
-n io.cert-manager \
3636
-p io.cert.manager \
37-
-o "$(pwd)"
37+
-o "$(pwd)"

client-java-contrib/prometheus-operator/update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# under src/main/java/io/cert/manager/models.
1818

1919
DEFAULT_IMAGE_NAME=docker.pkg.github.com/kubernetes-client/java/crd-model-gen
20-
DEFAULT_IMAGE_TAG=v1.0.2
20+
DEFAULT_IMAGE_TAG=v1.0.3
2121
IMAGE_NAME=${IMAGE_NAME:=$DEFAULT_IMAGE_NAME}
2222
IMAGE_TAG=${IMAGE_TAG:=$DEFAULT_IMAGE_TAG}
2323

@@ -40,4 +40,4 @@ docker run \
4040
-u https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.38.1/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml \
4141
-n com.coreos.monitoring \
4242
-p com.coreos.monitoring \
43-
-o "$(pwd)"
43+
-o "$(pwd)"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
GEN_BASE_IMAGE_NAME=ghcr.io/yue9944882/crd-model-gen-base # TODO: move this to kubernetes-client group after the permission issue fixed
4+
GEN_BASE_IMAGE_VERSION=v1.0.0
5+
6+
docker build -t ${GEN_BASE_IMAGE_NAME}:${GEN_BASE_IMAGE_VERSION} .
7+
docker push ${GEN_BASE_IMAGE_NAME}:${GEN_BASE_IMAGE_VERSION}
8+
9+
GEN_IMAGE_NAME=docker.pkg.github.com/kubernetes-client/java/crd-model-gen
10+
GEN_IMAGE_VERSION=v1.0.3
11+
12+
docker build -t ${GEN_IMAGE_NAME}:${GEN_IMAGE_VERSION} .
13+
docker push ${GEN_IMAGE_NAME}:${GEN_IMAGE_VERSION}

docs/generate-model-from-third-party-resources.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and [KubernetesListObject](https://github.com/kubernetes-client/java/blob/master
77

88
### Setup Environment
99

10+
__Note__: You can skip this section by replacing image prefix `docker.pkg.github.com/kubernetes-client/java/..`
11+
to `ghcr.io/yue9944882/..` which is a mirror repository allows anonymous access. `docker.pkg.github.com/kubernetes-client/java/..`
12+
will require docker-login due to `kubernetes-client` permission limit.
13+
1014
1. Make there's an active docker daemon service working on your host, run `docker ps` to check it if
1115
it's correctly setup.
1216

@@ -53,7 +57,7 @@ docker run \
5357
-v "$(pwd)":"$(pwd)" \
5458
-ti \
5559
--network host \
56-
docker.pkg.github.com/kubernetes-client/java/crd-model-gen:v1.0.2 \
60+
docker.pkg.github.com/kubernetes-client/java/crd-model-gen:v1.0.3 \
5761
/generate.sh \
5862
-u https://gist.githubusercontent.com/yue9944882/266fee8e95c2f15a93778263633e72ed/raw/be12c13379eeed13d2532cb65da61fffb19ee3e7/crontab-crd.yaml \
5963
-n com.example.stable \
@@ -84,7 +88,7 @@ docker run \
8488
-v "$(pwd)":"$(pwd)" \
8589
-ti \
8690
--network host \
87-
docker.pkg.github.com/kubernetes-client/java/crd-model-gen:v1.0.2 \
91+
docker.pkg.github.com/kubernetes-client/java/crd-model-gen:v1.0.3 \
8892
/generate.sh \
8993
-u $LOCAL_MANIFEST_FILE \
9094
-n com.example.stable \

0 commit comments

Comments
 (0)