|
| 1 | +FROM alpine:3.16 |
| 2 | + |
| 3 | +RUN set -x && \ |
| 4 | + apk add --no-cache bash ca-certificates git icu-dev python3-dev openssl nodejs npm build-base openjdk11 && \ |
| 5 | + update-ca-certificates |
| 6 | + |
| 7 | +ENV MAVEN_VERSION=3.8.6 |
| 8 | +ENV MAVEN_HOME=/usr/share/maven |
| 9 | + |
| 10 | +# Installing dependencies |
| 11 | +RUN python3 -m ensurepip --upgrade && \ |
| 12 | + pip3 install prance[osv,cli] && \ |
| 13 | + npm install -g typescript yarn |
| 14 | + |
| 15 | +# Installing maven |
| 16 | +RUN cd /tmp \ |
| 17 | + && wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \ |
| 18 | + && wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz.sha512 \ |
| 19 | + && echo -e "$(cat apache-maven-$MAVEN_VERSION-bin.tar.gz.sha512) apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha512sum -c - \ |
| 20 | + && tar zxf apache-maven-$MAVEN_VERSION-bin.tar.gz \ |
| 21 | + && rm -rf apache-maven-$MAVEN_VERSION-bin.tar.gz \ |
| 22 | + && rm -rf *.sha1 \ |
| 23 | + && mv ./apache-maven-$MAVEN_VERSION /usr/share/maven \ |
| 24 | + && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn |
| 25 | + |
| 26 | +ENV GEN_DIR /opt/openapi-generator |
| 27 | +WORKDIR ${GEN_DIR} |
| 28 | +VOLUME ${MAVEN_HOME}/.m2/repository |
| 29 | + |
| 30 | +# Required from a licensing standpoint |
| 31 | +COPY src/LICENSE ${GEN_DIR} |
| 32 | + |
| 33 | +# Required to compile openapi-generator |
| 34 | +COPY src/google_checkstyle.xml ${GEN_DIR} |
| 35 | + |
| 36 | +# Modules are copied individually here to allow for caching of docker layers between major.minor versions |
| 37 | +COPY src/modules/openapi-generator-gradle-plugin ${GEN_DIR}/modules/openapi-generator-gradle-plugin |
| 38 | +COPY src/modules/openapi-generator-maven-plugin ${GEN_DIR}/modules/openapi-generator-maven-plugin |
| 39 | +COPY src/modules/openapi-generator-online ${GEN_DIR}/modules/openapi-generator-online |
| 40 | +COPY src/modules/openapi-generator-cli ${GEN_DIR}/modules/openapi-generator-cli |
| 41 | +COPY src/modules/openapi-generator-core ${GEN_DIR}/modules/openapi-generator-core |
| 42 | +COPY src/modules/openapi-generator ${GEN_DIR}/modules/openapi-generator |
| 43 | +COPY src/pom.xml ${GEN_DIR} |
| 44 | + |
| 45 | +# Pre-compile openapi-generator-cli |
| 46 | +RUN mvn -am -pl "modules/openapi-generator-cli" package |
| 47 | + |
| 48 | +# This exists at the end of the file to benefit from cached layers when modifying docker-entrypoint.sh. |
| 49 | +COPY src/docker-entrypoint.sh /usr/local/bin/ |
| 50 | +RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator |
| 51 | + |
| 52 | +ENTRYPOINT ["docker-entrypoint.sh"] |
| 53 | + |
| 54 | +CMD ["help"] |
0 commit comments