Some checks failed
Build and Push Docker Image / build (push) Failing after 6m27s
Add simple Node.js Hello World application with automated Docker build and push workflow using Gitea Actions. The workflow builds and pushes images to the Gitea registry with versioning from package.json. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
80 lines
2.3 KiB
Markdown
80 lines
2.3 KiB
Markdown
# Gitea Actions Demo Project
|
|
|
|
A simple Node.js "Hello World" application demonstrating Gitea Actions CI/CD pipeline with Docker build and push.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── .gitea/
|
|
│ └── workflows/
|
|
│ └── build.yml # Gitea Actions workflow
|
|
├── index.js # Main application
|
|
├── package.json # Project configuration
|
|
├── Dockerfile # Docker image definition
|
|
├── .dockerignore # Docker ignore file
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Application
|
|
|
|
The application is a simple Node.js script that prints "Hello World" to the console.
|
|
|
|
### Running Locally
|
|
|
|
```bash
|
|
node index.js
|
|
```
|
|
|
|
### Running with Docker
|
|
|
|
```bash
|
|
# Build the image
|
|
docker build -t gitea-actions-demo-project:1.0.0 .
|
|
|
|
# Run the container
|
|
docker run gitea-actions-demo-project:1.0.0
|
|
```
|
|
|
|
## Gitea Actions CI/CD Pipeline
|
|
|
|
The project includes a Gitea Actions workflow that automatically:
|
|
|
|
1. Triggers on push to `master` or `main` branches
|
|
2. Checks out the code
|
|
3. Reads the version from `package.json`
|
|
4. Builds a Docker image
|
|
5. Pushes the image to `registry.budakova.org/knee-cola/gitea-actions-demo-project:<version>`
|
|
6. Also tags and pushes as `latest`
|
|
|
|
### Setup Requirements
|
|
|
|
To use the Gitea Actions workflow, you need to configure the following secrets in your Gitea repository:
|
|
|
|
1. Go to your repository settings
|
|
2. Navigate to Secrets section
|
|
3. Add the following secrets:
|
|
- `DOCKER_USERNAME`: Your Docker registry username
|
|
- `DOCKER_PASSWORD`: Your Docker registry password
|
|
|
|
### Workflow File
|
|
|
|
The workflow is defined in [.gitea/workflows/build.yml](.gitea/workflows/build.yml)
|
|
|
|
### Image Naming
|
|
|
|
Images are pushed with two tags:
|
|
- `registry.budakova.org/knee-cola/gitea-actions-demo-project:<version-from-package.json>`
|
|
- `registry.budakova.org/knee-cola/gitea-actions-demo-project:latest`
|
|
|
|
## Updating the Version
|
|
|
|
To change the version of your Docker image, simply update the `version` field in [package.json](package.json). The next push to master/main will build and push the new version.
|
|
|
|
## Testing the Workflow
|
|
|
|
1. Make a change to the code or update the version in `package.json`
|
|
2. Commit and push to master/main branch
|
|
3. Check the Actions tab in your Gitea repository to see the workflow running
|
|
4. Once complete, your Docker image will be available at the registry
|