From f69c0d65600c6e1cdf3ec1138ed0efa423514daf Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 26 Dec 2025 00:18:10 +0000 Subject: [PATCH] fix: Udpate code --- .gitea/workflows/build.yaml | 30 +++++++++++++++++++++++ Dockerfile | 12 ++++++++++ README.md | 48 +++++++++++++++++++++++++++++++++++++ index.ts | 2 ++ 4 files changed, 92 insertions(+) create mode 100644 .gitea/workflows/build.yaml create mode 100644 Dockerfile create mode 100644 index.ts diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..3666ef5 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,30 @@ +name: Build and Publish Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ gitea.server_url }} + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ gitea.server_url }}/${{ gitea.repository }}:latest + ${{ gitea.server_url }}/${{ gitea.repository }}:${{ gitea.sha }} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6aab79b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Use official Bun image +FROM oven/bun:1-alpine + +# Set working directory +WORKDIR /app + +# Copy application files +COPY index.ts . + +# Run the application +CMD ["bun", "run", "index.ts"] + diff --git a/README.md b/README.md index e69de29..5396590 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,48 @@ +# Hello World - Bun.js + +A simple Hello World application built with Bun.js. + +## Run Locally + +```bash +bun run index.ts +``` + +## Run with Docker + +Build the image: + +```bash +docker build -t hello-bun . +``` + +Run the container: + +```bash +docker run hello-bun +``` + +## CI/CD Pipeline + +This repo includes a Gitea Actions workflow that automatically builds and publishes the Docker image to Gitea's container registry on every push to `main`. + +### Setup Required + +1. **Enable Actions** in your Gitea repository settings +2. **Create a secret** named `REGISTRY_TOKEN`: + - Go to Repository → Settings → Actions → Secrets + - Add a new secret `REGISTRY_TOKEN` with your Gitea access token + +### Pull the Published Image + +After the pipeline runs, pull your image: + +```bash +docker pull //:latest +``` + +## Output + +``` +Hello World! 🌍 +``` diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..5ebaf89 --- /dev/null +++ b/index.ts @@ -0,0 +1,2 @@ +console.log("Hello World! 🌍"); +