feat #6
@@ -20,15 +20,13 @@
|
|||||||
|
|
||||||
**Jobs:**
|
**Jobs:**
|
||||||
- Build React application
|
- Build React application
|
||||||
- Build Docker image
|
- Build Docker image locally
|
||||||
- Push to Docker registry
|
- Save image as tarball artifact
|
||||||
|
- Upload artifact for download (30 days retention)
|
||||||
|
|
||||||
**Required Secrets:**
|
**Output:**
|
||||||
- `DOCKER_USERNAME` - Docker registry username
|
- Docker image artifact: `configucci.tar`
|
||||||
- `DOCKER_PASSWORD` - Docker registry password/token
|
- Can be downloaded and loaded with: `docker load -i configucci.tar`
|
||||||
|
|
||||||
**Optional Variables:**
|
|
||||||
- `DOCKER_REGISTRY` - Registry URL (default: `docker.io`)
|
|
||||||
|
|
||||||
### 3. Deploy (`deploy.yml`)
|
### 3. Deploy (`deploy.yml`)
|
||||||
**Triggers:** Push to `main` branch
|
**Triggers:** Push to `main` branch
|
||||||
@@ -59,12 +57,6 @@ ENABLED = true
|
|||||||
### 2. Configure Secrets
|
### 2. Configure Secrets
|
||||||
Go to your repository → Settings → Secrets and add:
|
Go to your repository → Settings → Secrets and add:
|
||||||
|
|
||||||
**For Docker Build:**
|
|
||||||
```
|
|
||||||
DOCKER_USERNAME=your-username
|
|
||||||
DOCKER_PASSWORD=your-password-or-token
|
|
||||||
```
|
|
||||||
|
|
||||||
**For Deployment:**
|
**For Deployment:**
|
||||||
```
|
```
|
||||||
DEPLOY_HOST=your-server.com
|
DEPLOY_HOST=your-server.com
|
||||||
@@ -73,12 +65,7 @@ DEPLOY_KEY=<paste-ssh-private-key>
|
|||||||
DEPLOY_PORT=22
|
DEPLOY_PORT=22
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Configure Variables (Optional)
|
**No Docker secrets needed** - images are built locally and downloaded as artifacts!
|
||||||
Go to your repository → Settings → Variables and add:
|
|
||||||
|
|
||||||
```
|
|
||||||
DOCKER_REGISTRY=registry.example.com
|
|
||||||
```
|
|
||||||
|
|
||||||
## Workflow Files Location
|
## Workflow Files Location
|
||||||
`.gitea/workflows/`
|
`.gitea/workflows/`
|
||||||
@@ -107,6 +94,5 @@ Add these to your README.md:
|
|||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
[](https://git.six83.ru/ssa/configucci/actions/workflows/ci.yml)
|
[](https://git.six83.ru/ssa/configucci/actions/workflows/ci.yml)
|
||||||
[](https://git.six83.ru/ssa/configucci/actions/workflows/docker-build.yml)
|
|
||||||
[](https://git.six83.ru/ssa/configucci/actions/workflows/deploy.yml)
|
[](https://git.six83.ru/ssa/configucci/actions/workflows/deploy.yml)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Push Docker Image
|
name: Build Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -30,30 +30,22 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
- name: Build Docker image
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.DOCKER_REGISTRY || 'docker.io' }}
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Extract metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=sha,prefix=sha-
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: false
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
load: true
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
tags: configucci:latest
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: Save Docker image as tarball
|
||||||
|
run: docker save configucci:latest -o configucci.tar
|
||||||
|
|
||||||
|
- name: Upload Docker image artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: docker-image
|
||||||
|
path: configucci.tar
|
||||||
|
retention-days: 30
|
||||||
|
|||||||
Reference in New Issue
Block a user