dockerfile
FROM openjdk:8-jdk-alpine AS TEMP_BUILD_IMAGE
ENV ENVREFRESH_DATE 2023-06-12 15:00
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk update && apk add --no-cache bash curl wget zip
WORKDIR /app
COPY settings.gradle settings.gradle
COPY gradle gradle
COPY build.gradle build.gradle
COPY gradlew gradlew
RUN ./gradlew -v
COPY src src
COPY src/main/resources src/main/resources
RUN ./gradlew build --refresh-dependencies
RUN ./gradlew build
RUN ls /app/build/libs/
FROM openjdk:8-jdk-alpine
WORKDIR /app
COPY --from=TEMP_BUILD_IMAGE app/build/libs/dataExChangePlatform-0.0.1-SNAPSHOT.jar .
ENTRYPOINT ["java","-jar","dataExChangePlatform-0.0.1-SNAPSHOT.jar"]
CMD ["-Duser.timezone=Asia/Shanghai","-Dspring.profiles.active=prod"]
docker-compose
version: '3'
services:
spring-boot-application:
container_name: spring-boot-application
build:
context: .
dockerfile: Dockerfile
privileged: true
ports:
- "8000:8000"
# command: ["/bin/sh","-c","sleep 300000"]
# command: ["java","-jar" ,"-Dspring.profiles.active=prod", "-Duser.timezone=Asia/Shanghai","/app/dataExChangePlatform-0.0.1-SNAPSHOT.jar"]
标签:RUN,springboot,app,kettle,jar,gradle,build,COPY,dockerfile
From: https://www.cnblogs.com/guanchaoguo/p/17475103.html