-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from lass9436/feature7
[이영민] step-8 페이징 구현하기
- Loading branch information
Showing
13 changed files
with
345 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Build and Deploy Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- lass9436 | ||
|
||
jobs: | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build Docker image | ||
run: docker build -t jsp-cafe:latest . | ||
|
||
- name: Save Docker image to file | ||
run: docker save jsp-cafe:latest | gzip > jsp-cafe.tar.gz | ||
|
||
- name: Upload Docker image file | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: docker-image | ||
path: jsp-cafe.tar.gz | ||
|
||
- name: Deploy to EC2 | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }} | ||
EC2_USER: ${{ secrets.EC2_USER }} | ||
EC2_HOST: ${{ secrets.EC2_HOST }} | ||
run: | | ||
# Save the SSH private key to a file | ||
echo "$SSH_PRIVATE_KEY" > private_key.pem | ||
chmod 600 private_key.pem | ||
# Transfer the Docker image file to EC2 server | ||
scp -i private_key.pem jsp-cafe.tar.gz $EC2_USER@$EC2_HOST:/tmp/ | ||
# Connect to EC2 server and run Docker commands | ||
ssh -i private_key.pem $EC2_USER@$EC2_HOST << 'EOF' | ||
docker load < /tmp/jsp-cafe.tar.gz | ||
docker stop jsp-cafe || true | ||
docker rm jsp-cafe || true | ||
docker run -d --name jsp-cafe -p 8080:8080 jsp-cafe:latest | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 빌드 스테이지: Gradle과 JDK 17을 사용하여 WAR 파일 빌드 | ||
FROM gradle:7.6.1-jdk17 AS build | ||
WORKDIR /app | ||
COPY . . | ||
RUN ./gradlew clean build | ||
|
||
# 실행 스테이지: Tomcat 10.1.26과 JDK 17을 사용하여 WAR 실행 | ||
FROM tomcat:10.1.26-jdk17 | ||
WORKDIR /usr/local/tomcat/webapps/ | ||
COPY --from=build /app/build/libs/*.war ./ROOT.war | ||
|
||
# 8080 포트 노출 (Tomcat 기본 포트) | ||
EXPOSE 8080 | ||
|
||
# Tomcat 실행 | ||
CMD ["catalina.sh", "run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.