Skip to content

Commit

Permalink
[docker] Cleanup and reduce container sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
jimschubert committed May 24, 2016
1 parent 917192e commit 1da350e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 38 deletions.
39 changes: 9 additions & 30 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git/
*.iml
out/
*.ipr
Expand All @@ -13,35 +14,13 @@ generated-sources/*
generated-code/*
*.swp
*.swo

/target
/generated-files
/nbactions.xml
*.pyc
__pycache__
samples/server-generator/scalatra/output
samples/server-generator/node/output/node_modules
samples/server-generator/scalatra/target
samples/server-generator/scalatra/output/.history
samples/client/petstore/qt5cpp/PetStore/moc_*
samples/client/petstore/qt5cpp/PetStore/*.o
samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata
samples/client/petstore/qt5cpp/build-*
samples/client/petstore/qt5cpp/PetStore/PetStore
samples/client/petstore/qt5cpp/PetStore/Makefile
samples/client/petstore/java/hello.txt
samples/client/petstore/android/default/hello.txt
samples/client/petstore/objc/Build
samples/client/petstore/objc/Pods
samples/server/petstore/nodejs/node_modules
target
.idea
.lib
atlassian-ide-plugin.xml
*.bak
project/
samples/*
target/
.idea/
.lib/
.DS_Store

samples/client/petstore/php/SwaggerClient-php/composer.lock
samples/client/petstore/php/SwaggerClient-php/vendor/

samples/client/petstore/silex/SwaggerServer/composer.lock
samples/client/petstore/silex/SwaggerServer/venodr/
# Not needed in a linux container
bin/windows/*
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM maven:3.3-jdk-7
FROM jimschubert/8-jdk-alpine-mvn

WORKDIR /src
VOLUME /src
VOLUME /root/.m2/repository
RUN mkdir /opt

ADD . /opt/swagger-codegen

RUN cd /opt/swagger-codegen && mvn package
WORKDIR /opt/swagger-codegen

ENTRYPOINT ["java", "-jar", "/opt/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"]
RUN mvn -am -pl "modules/swagger-codegen-cli" package && \
mv /opt/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar /opt/swagger-codegen/swagger-codegen-cli.jar && \
mvn clean && \
rm -rf ${MAVEN_HOME}/.m2/repository

ENTRYPOINT ["java", "-jar", "/opt/swagger-codegen/swagger-codegen-cli.jar"]

CMD ["help"]
5 changes: 3 additions & 2 deletions modules/swagger-generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM java:8-jdk
FROM jimschubert/8-jdk-alpine-mvn

WORKDIR /generator

COPY target/lib/jetty-runner* /generator/jetty-runner.jar
COPY target/*.war /generator/swagger-generator.war

ENV GENERATOR_HOST=https://generator.swaggerhub.com/api/swagger.json
RUN apt-get update

EXPOSE 8080

CMD ["java", "-jar", "/generator/jetty-runner.jar", "/generator/swagger-generator.war"]

0 comments on commit 1da350e

Please sign in to comment.