Dockerfile
Code Block |
---|
FROM gradle:4.2.1-jdk8-alpine as build WORKDIR /app COPY . /app COPY ./src /app/src user root RUN chmod +x ./gradlew RUN ./gradlew build FROM openjdk:8-jdk-alpine WORKDIR /app ENV ARTIFACT_NAME=demo-0.0.1-SNAPSHOT.jar COPY --from=build /app/build/libs/$ARTIFACT_NAME /app EXPOSE 8080 ENTRYPOINT /usr/bin/java -jar $ARTIFACT_NAME |
Dockerfile build
Code Block |
---|
[root@docker-compose-vm spring-reactor-redis]# docker build -t spring-reactor-redis:9 . Sending build context to Docker daemon 244.7kB Step 1/13 : FROM gradle:4.2.1-jdk8-alpine as build ---> 874e93a4569c Step 2/13 : WORKDIR /app ---> Using cache ---> c0e03516b2de Step 3/13 : COPY . /app ---> 0d587fe1f9c5 Step 4/13 : COPY ./src /app/src ---> e9343f3c7f74 Step 5/13 : user root ---> Running in 0d9b1a7d8f99 Removing intermediate container 0d9b1a7d8f99 ---> 1b00e0a661a7 Step 6/13 : RUN chmod +x ./gradlew ---> Running in 02504a5c6458 Removing intermediate container 02504a5c6458 ---> e2ca5ccdec7a Step 7/13 : RUN ./gradlew build ---> Running in dd33fa498727 Downloading https://services.gradle.org/distributions/gradle-5.2.1-bin.zip ................................................................................... Welcome to Gradle 5.2.1! Here are the highlights of this release: - Define sets of dependencies that work together with Java Platform plugin - New C++ plugins with dependency management built-in - New C++ project types for gradle init - Service injection into plugins and project extensions For more details see https://docs.gradle.org/5.2.1/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) > Task :compileJava > Task :processResources > Task :classes > Task :bootJar > Task :jar SKIPPED > Task :assemble > Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses > Task :test > Task :check > Task :build BUILD SUCCESSFUL in 1m 52s 5 actionable tasks: 5 executed Removing intermediate container dd33fa498727 ---> f77eaf208b67 Step 8/13 : FROM openjdk:8-jdk-alpine ---> 3675b9f543c5 Step 9/13 : WORKDIR /app ---> Using cache ---> 5921acfa59ec Step 10/13 : ENV ARTIFACT_NAME=demo-0.0.1-SNAPSHOT.jar ---> Using cache ---> 3089632629de Step 11/13 : COPY --from=build /app/build/libs/$ARTIFACT_NAME /app ---> 345527ee9267 Step 12/13 : EXPOSE 8080 ---> Running in 6db405924189 Removing intermediate container 6db405924189 ---> f09e09df249a Step 13/13 : ENTRYPOINT /usr/bin/java -jar $ARTIFACT_NAME ---> Running in a750c8fd7ba6 Removing intermediate container a750c8fd7ba6 ---> e6f029e72f31 Successfully built e6f029e72f31 Successfully tagged spring-reactor-redis:9 [root@docker-compose-vm spring-reactor-redis]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE spring-reactor-redis 9 e6f029e72f31 11 minutes ago 128MB |
Container 실행
Code Block |
---|
[root@docker-compose-vm spring-reactor-redis]# docker run -expose=8080:8080 -d spring-reactor-redis:9 14731ecacd7fbc003a574d8d80c71f68fe9da5e8dd73ac9d9d48b8e2ca1a5fe8 [root@docker-compose-vm spring-reactor-redis]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 14731ecacd7f spring-reactor-redis:9 "/bin/sh -c '/usr/bi..." 4 seconds ago Up 3 seconds 8080/tcp jovial_lichterman |
...