Dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright 2020 Docker, Inc.
  2. # Licensed under the Apache License, Version 2.0 (the "License");
  3. # you may not use this file except in compliance with the License.
  4. # You may obtain a copy of the License at
  5. # http://www.apache.org/licenses/LICENSE-2.0
  6. # Unless required by applicable law or agreed to in writing, software
  7. # distributed under the License is distributed on an "AS IS" BASIS,
  8. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. # See the License for the specific language governing permissions and
  10. # limitations under the License.
  11. # BUILD
  12. FROM openjdk:8u171-jdk-alpine as build
  13. RUN MAVEN_VERSION=3.5.0 \
  14. && cd /usr/share \
  15. && wget http://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz -O - | tar xzf - \
  16. && mv /usr/share/apache-maven-$MAVEN_VERSION /usr/share/maven \
  17. && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
  18. WORKDIR /home/lab
  19. COPY pom.xml .
  20. RUN mvn verify -DskipTests --fail-never
  21. COPY src ./src
  22. RUN mvn verify
  23. # RUN
  24. FROM openjdk:8u171-jre-alpine
  25. ENTRYPOINT ["java", "-Xmx8m", "-Xms8m", "-jar", "/app/words.jar"]
  26. EXPOSE 8080
  27. WORKDIR /app
  28. COPY --from=build /home/lab/target .