Some checks failed
Deploy to Coolify / deploy (push) Failing after 7m5s
- Enhance lexical editor with formatting options (strikethrough, inline code, subscript, superscript), lists (unordered, ordered, checklist), tables, alignment, indentation, blockquotes, horizontal rules, uploads, and relationships - Update Dockerfile for improved build process, including .npmrc support, pnpm config, telemetry disable, and production optimizations - Modify CI workflow to deploy only, removing local build steps and updating webhook trigger - Add .dockerignore file and deployment documentation for Docker build and push workflow - Configure Next.js for standalone output in next.config.js BREAKING CHANGE: CI workflow now requires local Docker builds before pushing code, as automated builds have been removed.
113 lines
2.8 KiB
Markdown
113 lines
2.8 KiB
Markdown
---
|
|
description: Build Docker image and push to Docker Hub for Coolify deployment
|
|
---
|
|
|
|
# Docker Build and Push Workflow
|
|
|
|
This workflow builds a Docker image locally and pushes it to Docker Hub so it can be deployed to Coolify.
|
|
|
|
## Prerequisites
|
|
|
|
1. **Docker Hub Account**: Make sure you have a Docker Hub account
|
|
2. **Docker Hub Login**: Log in to Docker Hub from your terminal
|
|
|
|
```bash
|
|
docker login
|
|
```
|
|
|
|
Enter your Docker Hub username and password when prompted.
|
|
|
|
## Workflow Steps
|
|
|
|
### 1. Build the Docker Image
|
|
|
|
Build your Docker image with a tag that includes your Docker Hub username:
|
|
|
|
```bash
|
|
docker build -t YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:latest .
|
|
```
|
|
|
|
Replace `YOUR_DOCKERHUB_USERNAME` with your actual Docker Hub username.
|
|
|
|
You can also add a specific version tag:
|
|
|
|
```bash
|
|
docker build -t YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:v1.0.0 .
|
|
```
|
|
|
|
### 2. (Optional) Test the Image Locally
|
|
|
|
Before pushing, you can test the image locally:
|
|
|
|
```bash
|
|
docker run -p 3000:3000 YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:latest
|
|
```
|
|
|
|
### 3. Push to Docker Hub
|
|
|
|
Push the image to Docker Hub:
|
|
|
|
```bash
|
|
docker push YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:latest
|
|
```
|
|
|
|
If you tagged a specific version, push that too:
|
|
|
|
```bash
|
|
docker push YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:v1.0.0
|
|
```
|
|
|
|
### 4. Deploy to Coolify
|
|
|
|
In your Coolify dashboard:
|
|
|
|
1. Create a new service or edit your existing service
|
|
2. Select **Docker Image** as the source
|
|
3. Enter your image name: `YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:latest`
|
|
4. Configure environment variables if needed
|
|
5. Deploy
|
|
|
|
Coolify will pull the image from Docker Hub and deploy it.
|
|
|
|
## Automated Deployment with Gitea Actions
|
|
|
|
Since building happens locally, the Gitea workflow only triggers Coolify deployment. Here's a sample workflow for `.gitea/workflows/deploy.yaml`:
|
|
|
|
```yaml
|
|
name: Deploy to Coolify
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Trigger Coolify Deployment
|
|
run: |
|
|
curl -X POST "${{ secrets.COOLIFY_WEBHOOK_URL }}"
|
|
```
|
|
|
|
### Setup Instructions:
|
|
|
|
1. **Get Coolify Webhook URL**:
|
|
- In Coolify, go to your service settings
|
|
- Find the "Webhooks" section
|
|
- Copy the webhook URL
|
|
|
|
2. **Add to Gitea Secrets**:
|
|
- Go to your repository in Gitea
|
|
- Navigate to Settings → Secrets
|
|
- Add `COOLIFY_WEBHOOK_URL` with the webhook URL from Coolify
|
|
|
|
### Workflow:
|
|
|
|
1. **Build and push locally** (steps 1-3 above)
|
|
2. **Push code to Gitea** - This triggers the Gitea workflow
|
|
3. **Gitea notifies Coolify** - Coolify pulls the latest image from Docker Hub
|
|
4. **Coolify redeploys** - Your service is updated with the new image
|
|
|
|
**Note**: Make sure your Coolify service is configured to use the Docker image from Docker Hub (`YOUR_DOCKERHUB_USERNAME/website-ricenoodletw-cms:latest`).
|