ㅇ SpringBoot(Gradle) - Docker - EC2에 배포되는 기본적인 방법에 대한 설명
ㅇ Proejct Dockerfile 생성
FROM openjdk:8-jdk-alpine AS builder
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
COPY src src
RUN chmod +x ./gradlew
RUN ./gradlew bootJar
FROM openjdk:8-jdk-alpine
ARG JAR_FILE=build/libs/*.jar
COPY --from=builder ${JAR_FILE} app.jar
EXPOSE 8081
ENTRYPOINT ["java", "-jar", "/app.jar"]
ㅇ Docker build
docker build -t 계정명/프로젝트명:latest .
ㅇ Docker push ( → Docker hub)
docker push 계정명/프로젝트명:latest
ㅇ EC2 pull
docker pull 계정명/프로젝트명:latest
ㅇ EC2 run
docker run -d -p 8080:8081 계정명/프로젝트명:latest
참조 : https://devfoxstar.github.io/java/springboot-docker-ec2-deploy/
'CI/CD' 카테고리의 다른 글
CI/CD Tool 비교 (0) | 2023.01.29 |
---|---|
CI/CD 란? (0) | 2023.01.29 |