2017-08-10 03:49:03 -07:00
|
|
|
# Copyright 2017 The Kubernetes Authors.
|
|
|
|
|
#
|
|
|
|
|
# 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.
|
|
|
|
|
|
2017-12-30 22:34:16 -08:00
|
|
|
FROM maven:3.5-jdk-8-slim
|
2017-08-10 03:49:03 -07:00
|
|
|
|
2018-01-25 21:59:26 -08:00
|
|
|
# Install Autorest
|
|
|
|
|
RUN apt-get update && apt-get -qq -y install libunwind8 libicu57 libssl1.0 liblttng-ust0 libcurl3 libuuid1 libkrb5-3 zlib1g
|
2020-10-08 19:43:06 -07:00
|
|
|
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
2018-01-25 21:59:26 -08:00
|
|
|
RUN apt-get update && apt-get -y install \
|
|
|
|
|
nodejs \
|
|
|
|
|
libunwind8-dev \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2021-06-14 05:49:03 +08:00
|
|
|
# Install preprocessing script requirements
|
|
|
|
|
RUN apt-get update && apt-get -y install git python-pip && pip install urllib3==1.24.2
|
2017-08-10 03:49:03 -07:00
|
|
|
|
2018-08-13 08:21:39 -07:00
|
|
|
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
|
|
|
|
|
RUN mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
|
|
|
|
|
RUN curl https://packages.microsoft.com/config/debian/9/prod.list > prod.list
|
|
|
|
|
RUN mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
|
|
|
|
|
RUN chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
|
|
|
|
|
RUN chown root:root /etc/apt/sources.list.d/microsoft-prod.list
|
|
|
|
|
|
|
|
|
|
RUN apt-get update
|
2021-09-20 09:02:15 -07:00
|
|
|
RUN apt-get install -yy -q dotnet-sdk-5.0
|
2018-08-13 08:21:39 -07:00
|
|
|
|
2021-06-14 05:49:03 +08:00
|
|
|
ARG OPENAPI_GENERATOR_COMMIT
|
|
|
|
|
ARG GENERATION_XML_FILE
|
|
|
|
|
ARG OPENAPI_GENERATOR_USER_ORG=OpenAPITools
|
|
|
|
|
|
|
|
|
|
# Check out specific commit of openapi-generator
|
|
|
|
|
RUN mkdir /source && \
|
|
|
|
|
cd /source && \
|
|
|
|
|
git clone -n https://github.com/${OPENAPI_GENERATOR_USER_ORG}/openapi-generator.git && \
|
|
|
|
|
cd openapi-generator && \
|
|
|
|
|
git checkout $OPENAPI_GENERATOR_COMMIT
|
|
|
|
|
|
|
|
|
|
# Build it and persist local repository
|
2021-09-20 09:02:15 -07:00
|
|
|
RUN mkdir /.dotnet && chmod -R go+rwx /.dotnet && mkdir /.nuget && chmod -R go+rwx /.nuget && chmod -R go+rwx /root && umask 0 && cd /source/openapi-generator && \
|
2021-06-14 05:49:03 +08:00
|
|
|
mvn install -DskipTests -Dmaven.test.skip=true -pl modules/openapi-generator-maven-plugin -am && \
|
|
|
|
|
cp -r /root/.m2/* /usr/share/maven/ref
|
2018-08-13 08:21:39 -07:00
|
|
|
|
2017-08-10 03:49:03 -07:00
|
|
|
# Copy required files
|
2019-01-15 07:52:13 +01:00
|
|
|
COPY openapi-generator/generate_client_in_container.sh /generate_client.sh
|
2017-08-10 03:49:03 -07:00
|
|
|
COPY preprocess_spec.py /
|
|
|
|
|
COPY custom_objects_spec.json /
|
2017-11-24 14:38:37 +08:00
|
|
|
COPY ${GENERATION_XML_FILE} /generation_params.xml
|
2017-08-10 03:49:03 -07:00
|
|
|
|
2021-09-20 09:02:15 -07:00
|
|
|
# TODO bolian remove after C# generator stop reading ../version
|
|
|
|
|
RUN mkdir /Versioning && chmod -R go+rwx /Versioning
|
|
|
|
|
|
2017-08-10 03:49:03 -07:00
|
|
|
ENTRYPOINT ["mvn-entrypoint.sh", "/generate_client.sh"]
|