-
Notifications
You must be signed in to change notification settings - Fork 2
infra: Github Actions Docker Compose CD 파이프 라인 구축 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR establishes a GitHub Actions CD pipeline using Docker Compose for automated deployment. The setup includes containerization of a Spring Boot application and automated deployment to a remote server.
- Docker containerization setup with Dockerfile and compose configuration
- GitHub Actions workflow for automated build, test, and deployment
- Docker image management with automated push to Docker Hub and remote server deployment
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| docker-compose-dev.yaml | Defines Spring application service with health checks, logging, and networking configuration |
| Dockerfile | Creates containerized Spring Boot application using OpenJDK 21 |
| .github/workflows/push-cd-dev.yml | Implements CD pipeline with build, Docker operations, and remote deployment |
| .dockerignore | Excludes unnecessary files from Docker build context for optimized image creation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| pull_request: | ||
| branches: [ dev, main ] | ||
| types: [ opened, synchronize, reopened ] | ||
|
|
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow is named 'CD for Dev Push' but is triggered on pull_request events, not push events. CD (Continuous Deployment) should typically run on push to deploy changes, not on pull requests which are usually for CI (Continuous Integration).
| push: | |
| branches: [ dev, main ] |
| docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest . | ||
| - name: Log in to Docker Hub | ||
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker credentials are exposed in the workflow logs. Consider using the official docker/login-action@v3 which handles credentials more securely.
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} |
| cd /home/${{ secrets.SERVER_USER }}/app | ||
| echo "${{ secrets.ENV_FILE }}" > /home/${{ secrets.SERVER_USER }}/app/.env | ||
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing environment variables directly to a file on the remote server exposes sensitive data in workflow logs and command history. Consider using a more secure method to transfer environment variables.
| - name: Write .env file locally | |
| run: | | |
| echo "${{ secrets.ENV_FILE }}" > .env | |
| shell: bash | |
| - name: Copy .env file to server | |
| run: | | |
| scp -i ~/.ssh/my-key.pem -o StrictHostKeyChecking=no .env ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/home/${{ secrets.SERVER_USER }}/app/.env | |
| - name: Deploy and Restart Container | |
| run: | | |
| ssh -i ~/.ssh/my-key.pem ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF' | |
| mkdir -p /home/${{ secrets.SERVER_USER }}/app | |
| cd /home/${{ secrets.SERVER_USER }}/app |
| networks: | ||
| - app-network | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:${SERVER_PORT}/actuator/health"] |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The health check assumes curl is available in the container, but the Dockerfile uses openjdk:21-jdk-slim which doesn't include curl by default. This will cause health checks to fail.
| test: ["CMD", "curl", "-f", "http://localhost:${SERVER_PORT}/actuator/health"] | |
| test: ["CMD-SHELL", "command -v curl >/dev/null 2>&1 && curl -f http://localhost:${SERVER_PORT}/actuator/health || exit 1"] |
| !build/libs/*.jar | ||
| .gradle/ | ||
| !gradle/wrapper/gradle-wrapper.jar | ||
| .gradle/ |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .gradle/ directory is listed twice (lines 30 and 32), which is redundant.
| .gradle/ |
📋 상세 설명
📊 체크리스트
📆 마감일