Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
abwarten committed Aug 12, 2024
1 parent 1b17a7e commit d51de01
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/ci-cd-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: DEV CI/CD Pipeline

on:
push:
branches:
- dev

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}

- name: Configure docker for gcloud
run: gcloud auth configure-docker asia-northeast3-docker.pkg.dev

- name: Build and push Docker image
run: |
docker buildx build --push \
--tag asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-dev/flow-admin-main-dev:${{ github.sha }} .
deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout deployment repo
uses: actions/[email protected]
with:
repository: code-review-platform-flow/flow-manifest
path: manifests
token: ${{ secrets.FLOW_DEPLOY_KEY }}

- name: List files for debugging
run: ls -R

- name: Update manifest
run: |
sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-dev/flow-admin-main-dev:${{ github.sha }}|" manifests/flow-admin-main-dev/deployment.yaml
- name: Commit and push changes
working-directory: manifests
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add .
git commit -m "Update image to asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-dev/flow-admin-main-dev:${{ github.sha }}"
git push
66 changes: 66 additions & 0 deletions .github/workflows/ci-cd-prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: DEV CI/CD Pipeline

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}

- name: Configure docker for gcloud
run: gcloud auth configure-docker asia-northeast3-docker.pkg.dev

- name: Build and push Docker image
run: |
docker buildx build --push \
--tag asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-prd/flow-admin-main-prd:${{ github.sha }} .
deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout deployment repo
uses: actions/[email protected]
with:
repository: code-review-platform-flow/flow-manifest
path: manifests
token: ${{ secrets.FLOW_DEPLOY_KEY }}

- name: List files for debugging
run: ls -R

- name: Update manifest
run: |
sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-prd/flow-admin-main-prd:${{ github.sha }}|" manifests/flow-admin-main-prd/deployment.yaml
- name: Commit and push changes
working-directory: manifests
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add .
git commit -m "Update image to asia-northeast3-docker.pkg.dev/code-review-platform-flow/flow-prd/flow-admin-main-prd:${{ github.sha }}"
git push
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# builder image
FROM amazoncorretto:17-al2-jdk AS builder

RUN mkdir /flow-admin-main
WORKDIR /flow-admin-main

COPY . .

RUN chmod +x gradlew
RUN ./gradlew clean bootJar

# runtime image
FROM amazoncorretto:17.0.12-al2

ENV TZ=Asia/Seoul
ENV PROFILE=${PROFILE}

RUN mkdir /flow-admin-main
WORKDIR /flow-admin-main

COPY --from=builder /flow-admin-main/build/libs/flow-admin-main-* /flow-admin-main/app.jar

CMD ["sh", "-c", " \
java -Dspring.profiles.active=${PROFILE} \
-jar /flow-admin-main/app.jar"]
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'admin'
rootProject.name = 'main'

0 comments on commit d51de01

Please sign in to comment.