From c94fce57aeea7f45718e143a280ee6bfc306193c Mon Sep 17 00:00:00 2001 From: Daniel Sy Date: Fri, 28 Mar 2025 05:04:05 +0100 Subject: [PATCH 1/2] feat(#3): :package: Dockerize loic --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..06798d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.24 AS builder +WORKDIR /app +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -o loic . +RUN ls -l /app/loic + +FROM alpine:latest +WORKDIR /app/ +COPY --from=builder /app/loic . +COPY pkg/web/templates/ pkg/web/templates/ +ENTRYPOINT [ "./loic" ] +CMD [ "web" ] From 3f6abd393c78d65fa1f84bfab3021ffc420fc88a Mon Sep 17 00:00:00 2001 From: Patrick Sy Date: Mon, 31 Mar 2025 16:46:55 +0200 Subject: [PATCH 2/2] ci: Added minimal forgejo actions workflow --- .forgejo/workflows/build.yml | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .forgejo/workflows/build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..571e980 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,57 @@ +name: Build + +on: + push: + branches-ignore: + - 'dependabot/**' #avoid duplicates: only run the PR, not the push + pull_request: + +env: + CI: true + GO_VERSION: '1.24.1' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install dependencies + run: go get . + + - name: Build + run: go build -o loic + + - name: Test + run: go test + + + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install dependencies + run: go get . + + - name: Formatting + run: test -z $(gofmt -l .) + + - name: golangci-lint + uses: https://github.com/golangci/golangci-lint-action@v7 + with: + version: v2.0