-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
43 lines (32 loc) · 1.45 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# build plugin
FROM amazoncorretto:11-alpine AS generator-builder
ENV MAVEN_VERSION=3.8.8
ENV MAVEN_HOME=/usr/share/maven
ENV PATH=${MAVEN_HOME}/bin:${PATH}
RUN apk add --no-cache curl tar bash \
&& echo ${MAVEN_HOME} \
&& curl -fsSL https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar -xzC /usr/share \
&& mv /usr/share/apache-maven-${MAVEN_VERSION} ${MAVEN_HOME} \
&& ln -s ${MAVEN_HOME}/bin/mvn /usr/bin/mvn \
&& apk del curl tar
WORKDIR /build
COPY ./generator/plugin /build
RUN --mount=type=cache,target=/root/.m2,sharing=locked mvn -U clean package -DskipTests
# build tools
FROM openapitools/openapi-generator-cli:v7.7.0
RUN apt-get update && apt-get install python3 python3-pip python3.8-venv -y
RUN pip install yapf
ENV GOLANG_VERSION=1.22.2
RUN curl -OL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz && \
rm go${GOLANG_VERSION}.linux-amd64.tar.gz
WORKDIR /APP
COPY --from=generator-builder /build/target/sdk-openapi-generator-1.0.0.jar /opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar
ENV CGO_ENABLED=0
ENV PATH="/usr/local/go/bin:$PATH"
ENV GOPATH="/go"
ENV PATH="$GOPATH/bin:$PATH"
ENV GO_POST_PROCESS_FILE="/usr/local/go/bin/gofmt -w"
ENV PYTHON_POST_PROCESS_FILE="/usr/local/bin/yapf -i"
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["help"]