feat : 권민혁 서비스 컨테이너 이미지 제작 #99
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
name: Build Image | |
on: [pull_request] | |
env: | |
CLUSTER_NAME: argoproj-ossca | |
IMAGE_NAME: ossca:test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Container Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: "{{defaultContext}}:${{ github.actor }}" | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: false | |
tags: ${{ env.IMAGE_NAME }} | |
load: true | |
- name: Set up environment (download Kubernetes dependencies) | |
run: | | |
TMP_DIR=$(mktemp -d) | |
# kubectl | |
curl -L https://dl.k8s.io/release/v1.30.2/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl | |
# kind | |
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 | |
# Helm | |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | |
chmod 700 get_helm.sh | |
./get_helm.sh | |
# Install | |
sudo cp ${TMP_DIR}/kubectl /usr/local/bin/kubectl | |
sudo cp ${TMP_DIR}/kind /usr/local/bin/kind | |
sudo chmod +x /usr/local/bin/* | |
sudo rm -rf ${TMP_DIR} | |
sudo rm -rf ./get_helm.sh | |
kubectl version --client=true -o yaml | |
kind --version | |
helm version | |
- name: Create Simple Node Cluster | |
run: | | |
echo "kind: Cluster | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
name: $CLUSTER_NAME | |
nodes: | |
- role: control-plane | |
extraPortMappings: | |
- containerPort: 30080 | |
hostPort: 30080 | |
- role: worker" >> config.yaml | |
kind create cluster --config ./config.yaml | |
- name: Image Upload to Kind | |
run: | | |
kind load docker-image ${{ env.IMAGE_NAME }} --name $CLUSTER_NAME | |
- name: Deployment Simple App | |
run: | | |
cd ${{ github.actor }} | |
helm install --wait --set image.name=${{ env.IMAGE_NAME }} ossca-test ./charts | |
- name: Check Deployment Success | |
run: | | |
docker ps | |
kubectl get pod --show-labels -o wide | |
kubectl get svc -o wide | |
curl -v localhost:30080/healthcheck |