Add GitHub Actions workflows for building and deploying application
This commit is contained in:
73
GITHUB_ACTIONS_README.md
Normal file
73
GITHUB_ACTIONS_README.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# GitHub Actions Configuration
|
||||
|
||||
This repository contains two separate GitHub Actions workflows for building and deploying your application:
|
||||
|
||||
## Workflows
|
||||
|
||||
### 1. Build Workflow (`build.yml`)
|
||||
- **Trigger**: Manual dispatch only
|
||||
- **Purpose**: Builds Docker image and pushes to private container registry
|
||||
|
||||
### 2. Deploy Workflow (`deploy.yml`)
|
||||
- **Trigger**: Manual dispatch only
|
||||
- **Purpose**: Deploys application to Kubernetes cluster with Traefik ingress
|
||||
|
||||
## Required GitHub Secrets
|
||||
|
||||
You need to configure the following secrets in your GitHub repository settings:
|
||||
|
||||
### Container Registry Secrets
|
||||
- `CONTAINER_REGISTRY` - Your private container registry URL (e.g., `myregistry.azurecr.io`)
|
||||
- `REGISTRY_USERNAME` - Username for container registry authentication
|
||||
- `REGISTRY_PASSWORD` - Password/token for container registry authentication
|
||||
- `IMAGE_NAME` - Name of your container image (e.g., `www-cialloo-com`)
|
||||
|
||||
### Kubernetes Secrets
|
||||
- `KUBECONFIG_BASE64` - Base64 encoded kubeconfig file for your remote K8s cluster
|
||||
- `K8S_NAMESPACE` - Kubernetes namespace to deploy to (e.g., `default` or `production`)
|
||||
|
||||
### Application Secrets
|
||||
- `APP_NAME` - Name of your application in Kubernetes (e.g., `www-cialloo-com`)
|
||||
- `HOST` - Your domain host (e.g., `www.cialloo.com`)
|
||||
|
||||
## How to Use
|
||||
|
||||
### Building an Image
|
||||
1. Go to Actions tab in your GitHub repository
|
||||
2. Select "Build Container Image" workflow
|
||||
3. Click "Run workflow"
|
||||
4. Optionally specify a custom tag (defaults to 'latest')
|
||||
|
||||
### Deploying to Kubernetes
|
||||
1. Go to Actions tab in your GitHub repository
|
||||
2. Select "Deploy to Kubernetes" workflow
|
||||
3. Click "Run workflow"
|
||||
4. Specify the image tag to deploy (e.g., 'latest', 'v1.0.0')
|
||||
5. Optionally specify environment (defaults to 'production')
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Configure Secrets
|
||||
Add all the required secrets listed above in your GitHub repository:
|
||||
- Go to Settings → Secrets and variables → Actions
|
||||
- Click "New repository secret" for each secret
|
||||
|
||||
### 2. Get Base64 Kubeconfig
|
||||
To get your `KUBECONFIG_BASE64` secret:
|
||||
```bash
|
||||
# On your local machine with kubectl configured for your cluster
|
||||
cat ~/.kube/config | base64 -w 0
|
||||
```
|
||||
Copy the output and use it as the `KUBECONFIG_BASE64` secret value.
|
||||
|
||||
### 3. Container Registry Setup
|
||||
Make sure your private container registry is set up and you have credentials that can push images.
|
||||
|
||||
## Architecture
|
||||
|
||||
The deployment creates:
|
||||
- **Deployment**: 2 replicas of your application
|
||||
- **Service**: ClusterIP service exposing port 80 → 5173
|
||||
- **IngressRoute**: Traefik ingress without TLS
|
||||
|
||||
The application runs `npm run dev` and serves on port 5173 inside the container.
|
||||
Reference in New Issue
Block a user