Skip to content

Commit cbf61d5

Browse files
jimschubertwing328
authored andcommitted
[docker] build files for automated builds (#836)
1 parent 39763a8 commit cbf61d5

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

.hub.cli.dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## The builder labeled image acts as a transient container which is meant to
2+
## hold all non-artifact code.
3+
##
4+
## You can build _just_ this part with:
5+
## docker --target builder -t container-name:builder -f .hub.cli.dockerfile .
6+
FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
7+
8+
RUN set -x && \
9+
apk add --no-cache bash
10+
11+
ENV GEN_DIR /opt/openapi-generator
12+
WORKDIR ${GEN_DIR}
13+
COPY . ${GEN_DIR}
14+
15+
# Pre-compile openapi-generator-cli
16+
RUN mvn -am -pl "modules/openapi-generator-cli" package
17+
18+
## The final (release) image
19+
## The resulting container here only needs the target jar
20+
## and ca-certificates (to be able to query HTTPS hosted specs)
21+
FROM openjdk:8-jre-alpine
22+
23+
ENV GEN_DIR /opt/openapi-generator
24+
25+
RUN apk --no-cache add ca-certificates bash
26+
RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target
27+
28+
WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target
29+
30+
COPY --from=builder ${GEN_DIR}/modules/openapi-generator-cli/target/openapi-generator-cli.jar ${GEN_DIR}/modules/openapi-generator-cli/target/openapi-generator-cli.jar
31+
32+
COPY docker-entrypoint.sh /usr/local/bin/
33+
34+
ENTRYPOINT ["docker-entrypoint.sh"]
35+
36+
CMD ["help"]

.hub.online.dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## The builder labeled image acts as a transient container which is meant to
2+
## hold all non-artifact code.
3+
##
4+
## You can build _just_ this part with:
5+
## docker --target builder -t container-name:builder -f .hub.online.dockerfile .
6+
FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
7+
8+
RUN set -x && \
9+
apk add --no-cache bash
10+
11+
ENV GEN_DIR /opt/openapi-generator
12+
WORKDIR ${GEN_DIR}
13+
COPY . ${GEN_DIR}
14+
15+
# Pre-compile openapi-generator-online
16+
RUN mvn -am -pl "modules/openapi-generator-online" package
17+
18+
## The final (release) image
19+
## The resulting container here only needs the target jar
20+
FROM openjdk:8-jre-alpine
21+
22+
ENV GEN_DIR /opt/openapi-generator
23+
ENV TARGET_DIR /generator
24+
25+
RUN mkdir -p ${TARGET_DIR}
26+
27+
WORKDIR ${TARGET_DIR}
28+
29+
COPY --from=builder ${GEN_DIR}/modules/openapi-generator-online/target/openapi-generator-*.jar ${TARGET_DIR}/openapi-generator-online.jar
30+
31+
ENV GENERATOR_HOST=http://localhost
32+
33+
EXPOSE 8080
34+
35+
CMD ["java", "-jar", "/generator/openapi-generator-online.jar"]

0 commit comments

Comments
 (0)