-
Notifications
You must be signed in to change notification settings - Fork 0
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 #5 from Footprints-Plan/cicd-test
[FP-75] Feat: 다중배포환경 세팅
- Loading branch information
Showing
12 changed files
with
131 additions
and
47 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 |
---|---|---|
|
@@ -3,6 +3,8 @@ name: Continuous Integration | |
on: | ||
push: | ||
branches: ["main"] | ||
paths-ignore: | ||
- 'xinfra/eks/**' | ||
|
||
permissions: | ||
id-token: write | ||
|
@@ -57,8 +59,8 @@ jobs: | |
- name: Set Spring Image Environment Variable | ||
run: | | ||
echo "SPRING_IMAGE=${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.REPOSITORY }}${{ env.IMAGE_TAG }}" >> ${GITHUB_ENV} | ||
echo "LATEST_IMAGE=${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.REPOSITORY }}:latest" >> ${GITHUB_ENV} | ||
echo "PROD_IMAGE=${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.REPOSITORY }}${{ env.IMAGE_TAG }}-prod" >> ${GITHUB_ENV} | ||
echo "DEV_IMAGE=${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.REPOSITORY }}${{ env.IMAGE_TAG }}-dev" >> ${GITHUB_ENV} | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
|
@@ -72,11 +74,26 @@ jobs: | |
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
|
||
- name: Build Image | ||
run: docker build --no-cache -t ${{ env.SPRING_IMAGE }} -f ./xinfra/docker/Dockerfile . | ||
- name: Build Prod Image | ||
run: docker build --no-cache -t ${{ env.PROD_IMAGE }} -f ./xinfra/docker/DockerfileProd . | ||
|
||
- name: Build Dev Image | ||
run: docker build --no-cache -t ${{ env.DEV_IMAGE }} -f ./xinfra/docker/DevDockerfileDev . | ||
|
||
- name: Push to ECR | ||
run: | | ||
docker push ${{ env.SPRING_IMAGE }} | ||
docker tag ${{ env.SPRING_IMAGE }} ${{ env.LATEST_IMAGE }} | ||
docker push ${{ env.LATEST_IMAGE }} | ||
docker push ${{ env.PROD_IMAGE }} | ||
docker push ${{ env.DEV_IMAGE }} | ||
- name: Update Kustomize with new images | ||
run: | | ||
sed -i "s|image:.*-prod|image: ${{ env.PROD_IMAGE }}|g" ./xinfra/eks/overlays/prod/patch.yaml | ||
sed -i "s|image:.*-dev|image: ${{ env.DEV_IMAGE }}|g" ./xinfra/eks/overlays/dev/patch.yaml | ||
- name: Commit and Push Changes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
git add ./xinfra/eks/overlays/prod/patch.yaml ./xinfra/eks/overlays/dev/patch.yaml | ||
git commit -m "Update kustomization files with new image tags" | ||
git push origin ${{ github.ref }} |
Submodule config
updated
from 1fb02c to 235aeb
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,10 @@ | ||
FROM eclipse-temurin:17-jre-jammy | ||
LABEL authors="tjdgns8439" | ||
|
||
WORKDIR /app | ||
|
||
COPY build/libs/*.jar /app/app.jar | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT java -jar "-Dspring.profiles.active=dev" /app/app.jar |
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,10 @@ | ||
FROM eclipse-temurin:17-jre-jammy | ||
LABEL authors="tjdgns8439" | ||
|
||
WORKDIR /app | ||
|
||
COPY build/libs/*.jar /app/app.jar | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT java -jar "-Dspring.profiles.active=prod" /app/app.jar |
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: springapp-deploy | ||
spec: | ||
replicas: 3 | ||
strategy: | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: springapp-pod | ||
template: | ||
metadata: | ||
labels: | ||
app: springapp-pod | ||
spec: | ||
containers: | ||
- name: springapp-pod | ||
imagePullPolicy: Always | ||
image: springapp-pod | ||
ports: | ||
- containerPort: 80 |
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,13 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: springapp | ||
commonLabels: | ||
app: springapp-pod | ||
|
||
images: | ||
- name: springapp-pod | ||
|
||
resources: | ||
- ./deployment.yaml | ||
- ./service.yaml |
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,11 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: springapp-svc | ||
spec: | ||
selector: | ||
app: springapp-pod | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
type: ClusterIP |
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,10 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: springapp-dev | ||
commonLabels: | ||
env: dev | ||
resources: | ||
- ../../base | ||
nameSuffix: -dev | ||
patchesStrategicMerge: | ||
- patch.yaml |
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,10 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: springapp-deploy | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: springapp-deploy | ||
image: 992382409375.dkr.ecr.ap-northeast-2.amazonaws.com/footprints-dev:latest |
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,10 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: springapp-prod | ||
commonLabels: | ||
env: prod | ||
resources: | ||
- ../../base | ||
nameSuffix: -prod | ||
patchesStrategicMerge: | ||
- patch.yaml |
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,10 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: springapp-deploy | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: springapp-deploy | ||
image: 992382409375.dkr.ecr.ap-northeast-2.amazonaws.com/footprints-prod:latest |