Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

벌꿀오소리가 되고싶은

AWS EC2 + DOCKER + JENKINS + SPRING BOOT 본문

개발/개발 이모저모

AWS EC2 + DOCKER + JENKINS + SPRING BOOT

허니배져 2020. 3. 1. 00:32

AWS 인스턴스 생성후 Ubuntu 서버에 연동하기 

 

ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

 

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html

Connecting to Your Linux Instance Using SSH

docs.aws.amazon.com

 

 

 

스프링 부트로 웹 어플리케이션을 최소한으로 구현 

 

controller
hello.html

 

해당 웹 어플리케이션 최상단에 Dockerfile 만들어 주기

FROM은 새로운 이미지를 생성할 때 기반으로 사용할 이미지를 지정한다. 

 

ENTRYPOINT는 컨테이너를 시작할 때 실행할 명령어를 입력한다. 

 

http://longbe00.blogspot.com/2015/03/dockerfile.html

 

Dockerfile 명령어 정리

1.1     Dockerfile Dockerfile 은 Docker 이미지 설정 파일입니다 . Dockerfile 에 설정된 내용대로 이미지를 생성합니다 . 여러가지 명령을 토대로 기본 이미지에서 개발환경을 셋팅한 이미지를 생성할 수 있습...

longbe00.blogspot.com

 

docker build --tag springboot .

--tag(또는 -t) 옵션은 새로 생성할 이미지 이름을 지정한다. 

docer build -t $리파지토리이름:$태그 .

마지막에 점(.)은 Dockerfile의 위치를 경로를 지정한다. 파일 이름이 Dockerfile이 아닌 경우 --file(또는 -f) 옵션을 사용해서 파일 이름을 지정한다.

 

해당 도커파일이 빌드가 성공적으로 완료되면 도커이미지가 만들어 진것을 확인 할 수 있다.

$ docker images

REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
<none>                    <none>              77af4d6b9913        19 hours ago        1.089 GB
committ                   latest              b6fa739cedf5        19 hours ago        1.089 GB
<none>                    <none>              78a85c484f71        19 hours ago        1.089 GB
docker                    latest              30557a29d5ab        20 hours ago        1.089 GB
<none>                    <none>              5ed6274db6ce        24 hours ago        1.089 GB
postgres                  9                   746b819f315e        4 days ago          213.4 MB
postgres                  9.3                 746b819f315e        4 days ago          213.4 MB
postgres                  9.3.5               746b819f315e        4 days ago          213.4 MB
postgres                  latest              746b819f315e        4 days ago          213.4 MB

 

 

젠킨스 도커 pull 받아오기

스프링 부트가  java11에서 돌아갈 수 있도록 

docker pull jenkins/jenkins:jdk11
docker run -d -ti -p 8080:8080 -p 50000:50000 \
            -v jenkins-home:/var/jenkins_home \
            -v /var/run/docker.sock:/var/run/docker.sock \
            jenkins/jenkins:jdk11

https://jenkins.io/doc/administration/requirements/jenkins-on-java-11/

 

Running Jenkins on Java 11

Jenkins – an open source automation server which enables developers around the world to reliably build, test, and deploy their software

jenkins.io

https://riptutorial.com/ko/docker/example/25889/docker%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-jenkins-ci-%EC%BB%A8%ED%85%8C%EC%9D%B4%EB%84%88

 

Docker - Docker를 사용하는 Jenkins CI 컨테이너 | docker Tutorial

docker documentation: Docker를 사용하는 Jenkins CI 컨테이너

riptutorial.com

https://nuggy875.tistory.com/49

 

Docker run 옵션 정리

docker run 명령어 $ docker run [Options] [Image] [Command] [Options] -it -i : interactive, -t ; tty 이 옵션을 줘야 컨테이너 안에서 터미널 실행 가능 -p [호스트의 포트:컨테이너 포트] -p 8888:8888 도커..

nuggy875.tistory.com

 

 

[DevOps] Jenkins를 이용한 자동 빌드 및 배포(2): Gradle 기반 Application 실행

 

[DevOps] Jenkins를 이용한 자동 빌드 및 배포(2): Gradle 기반 Application 실행

Spring Boot Sample App을 Gitlab에 등록 먼저 간단한 Spring Boot 프로그램을 만들기위해 프로젝트를 생성하고 gitlab과 연동시켜 줍니다. Spring Boot Sample App은 루트 url로 접속하면 Hello World!를 반환하..

miiingo.tistory.com

 

Comments