From 19b9f62c469a00069418e34c02f91112d9ab7297 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Sun, 21 Dec 2025 14:04:38 +0100 Subject: [PATCH] feat: build and publish docker image --- .dockerignore | 7 +++++++ .gitea/workflows/build.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 16 ++++++++++++++++ src/index.ts | 5 +++++ 4 files changed, 57 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/build.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..34e1d96 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +dist +.git +.gitea +.env +*.log +README.md diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..d8ec475 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.pihkaal.xyz + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and push Docker image + run: | + docker build -t git.pihkaal.xyz/pihkaal/gitea-auto-urls:latest . + docker push git.pihkaal.xyz/pihkaal/gitea-auto-urls:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1201799 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:20-alpine + +WORKDIR /app + +COPY package.json pnpm-lock.yaml ./ + +RUN corepack enable && corepack prepare pnpm@10.25.0 --activate +RUN pnpm install --frozen-lockfile + +COPY . . + +RUN pnpm run build + +EXPOSE 3000 + +CMD ["node", "dist/index.js"] diff --git a/src/index.ts b/src/index.ts index 2e09a4a..9798429 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,11 @@ const app = express(); app.use(express.json()); +app.post("/", (req, res) => { + console.log(req); + res.sendStatus(200); +}); + app.listen(env.PORT, () => { console.log(`Server running on port ${env.PORT}`); });