From 4c68612ea05fba900aeeffa9caa75d301a7c56e3 Mon Sep 17 00:00:00 2001 From: Sebastiaan de Schaetzen Date: Sun, 25 May 2025 14:13:40 +0200 Subject: [PATCH] Add gitea workflow --- .gitea/workflows/build.yml | 24 ++++++++++++++++++++++++ .gitea/workflows/deploy.yml | 25 +++++++++++++++++++++++++ backend/Dockerfile | 14 ++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 .gitea/workflows/deploy.yml create mode 100644 backend/Dockerfile diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..9de519f --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,24 @@ +name: Backend Build and Test +on: [push] + +jobs: + build: + runs-on: standard-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '>=1.24' + + - name: Build + run: | + cd backend + go build . + + - name: Test + run: | + cd backend + go test . -v diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..634f65f --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,25 @@ +name: Backend Deploy +on: + push: [main] + +jobs: + build: + runs-on: standard-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login + with: + package_rw: ${{ secrets.PACKAGE_RW }} + run: docker login gitea.seeseepuff.be -u seeseemelk -p ${{ secrets.PACKAGE_RW }} + + - name: Build + run: | + cd backend + docker build -t gitea.seeseepuff.be/seeseemelk/wolproxy:$(git rev-parse --short HEAD) . + + - name: Push + run: | + cd backend + docker push gitea.seeseepuff.be/seeseemelk/wolproxy:$(git rev-parse --short HEAD) diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..95f19db --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.24.2-alpine3.21 + +WORKDIR /app +COPY go.mod go.sum ./ +RUN go mod download + +COPY migrations ./migrations/ +COPY *.go ./ +COPY *.gohtml ./ +RUN go build -o /allowance_planner + +EXPOSE 8080 +ENV GIN_MODE=release +CMD ["/allowance_planner"]