Optimize docker compilation time (#193)

This commit is contained in:
Albert
2021-06-14 05:49:03 +08:00
committed by GitHub
parent 9172958682
commit 13ed3b4657

View File

@@ -13,12 +13,6 @@
# limitations under the License.
FROM maven:3.5-jdk-8-slim
ARG OPENAPI_GENERATOR_COMMIT
ARG GENERATION_XML_FILE
ARG OPENAPI_GENERATOR_USER_ORG=OpenAPITools
# Install preprocessing script requirements
RUN apt-get update && apt-get -y install git python-pip && pip install urllib3==1.24.2
# Install Autorest
RUN apt-get update && apt-get -qq -y install libunwind8 libicu57 libssl1.0 liblttng-ust0 libcurl3 libuuid1 libkrb5-3 zlib1g
@@ -28,20 +22,10 @@ RUN apt-get update && apt-get -y install \
libunwind8-dev \
&& rm -rf /var/lib/apt/lists/*
# Install preprocessing script requirements
RUN apt-get update && apt-get -y install git python-pip && pip install urllib3==1.24.2
RUN npm install -g autorest@3
# 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
RUN mkdir /.npm && chmod -R go+rwx /.npm && chmod -R go+rwx /root && umask 0 && cd /source/openapi-generator && \
mvn install -DskipTests -Dmaven.test.skip=true -pl modules/openapi-generator-maven-plugin -am && \
cp -r /root/.m2/* /usr/share/maven/ref
RUN mkdir -p /node_modules && chmod -R go+rwx /node_modules
RUN npm install @microsoft.azure/autorest.csharp \
@microsoft.azure/autorest.modeler
@@ -56,6 +40,21 @@ RUN chown root:root /etc/apt/sources.list.d/microsoft-prod.list
RUN apt-get update
RUN apt-get install -yy -q dotnet-hosting-2.0.8
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
RUN mkdir /.npm && chmod -R go+rwx /.npm && chmod -R go+rwx /root && umask 0 && cd /source/openapi-generator && \
mvn install -DskipTests -Dmaven.test.skip=true -pl modules/openapi-generator-maven-plugin -am && \
cp -r /root/.m2/* /usr/share/maven/ref
# Copy required files
COPY openapi-generator/generate_client_in_container.sh /generate_client.sh