Skip to content

Commit

Permalink
feat: add openapi-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
aexvir committed Nov 7, 2022
1 parent 1bfa6c4 commit e0eb831
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "openapi-generator/src"]
path = openapi-generator/src
url = https://github.com/OpenAPITools/openapi-generator.git
54 changes: 54 additions & 0 deletions openapi-generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM alpine:3.16

RUN set -x && \
apk add --no-cache bash ca-certificates git icu-dev python3-dev openssl nodejs npm build-base openjdk11 && \
update-ca-certificates

ENV MAVEN_VERSION=3.8.6
ENV MAVEN_HOME=/usr/share/maven

# Installing dependencies
RUN python3 -m ensurepip --upgrade && \
pip3 install prance[osv,cli] && \
npm install -g typescript yarn

# Installing maven
RUN cd /tmp \
&& wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz \
&& wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz.sha512 \
&& echo -e "$(cat apache-maven-$MAVEN_VERSION-bin.tar.gz.sha512) apache-maven-$MAVEN_VERSION-bin.tar.gz" | sha512sum -c - \
&& tar zxf apache-maven-$MAVEN_VERSION-bin.tar.gz \
&& rm -rf apache-maven-$MAVEN_VERSION-bin.tar.gz \
&& rm -rf *.sha1 \
&& mv ./apache-maven-$MAVEN_VERSION /usr/share/maven \
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn

ENV GEN_DIR /opt/openapi-generator
WORKDIR ${GEN_DIR}
VOLUME ${MAVEN_HOME}/.m2/repository

# Required from a licensing standpoint
COPY src/LICENSE ${GEN_DIR}

# Required to compile openapi-generator
COPY src/google_checkstyle.xml ${GEN_DIR}

# Modules are copied individually here to allow for caching of docker layers between major.minor versions
COPY src/modules/openapi-generator-gradle-plugin ${GEN_DIR}/modules/openapi-generator-gradle-plugin
COPY src/modules/openapi-generator-maven-plugin ${GEN_DIR}/modules/openapi-generator-maven-plugin
COPY src/modules/openapi-generator-online ${GEN_DIR}/modules/openapi-generator-online
COPY src/modules/openapi-generator-cli ${GEN_DIR}/modules/openapi-generator-cli
COPY src/modules/openapi-generator-core ${GEN_DIR}/modules/openapi-generator-core
COPY src/modules/openapi-generator ${GEN_DIR}/modules/openapi-generator
COPY src/pom.xml ${GEN_DIR}

# Pre-compile openapi-generator-cli
RUN mvn -am -pl "modules/openapi-generator-cli" package

# This exists at the end of the file to benefit from cached layers when modifying docker-entrypoint.sh.
COPY src/docker-entrypoint.sh /usr/local/bin/
RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator

ENTRYPOINT ["docker-entrypoint.sh"]

CMD ["help"]
1 change: 1 addition & 0 deletions openapi-generator/src
Submodule src added at b0ce53

0 comments on commit e0eb831

Please sign in to comment.