From 5494a607ee002fb4e24da7feaf44b96a246284aa Mon Sep 17 00:00:00 2001 From: Lukas Jenicek Date: Sat, 3 Jun 2023 22:08:00 +0200 Subject: [PATCH] Build docker image in CI --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ .github/workflows/main.yml | 1 - Dockerfile | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8fe97b1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +name: Build static analysis tool with custom plugins +on: + push: + branches: + - master + pull_request: + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + docker-build: + runs-on: ubuntu-latest + steps: + - name: Git clone + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Log into Github registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Docker build + run: | + docker build -t ghcr.io/golang-cz/static-analysis . + docker push ghcr.io/golang-cz/static-analysis diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 8b13789..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Dockerfile b/Dockerfile index 1fb21ce..a60e033 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ FROM golang:1.20 as builder COPY / /golangci WORKDIR /golangci -RUN CGO_ENABLED=1 go build -trimpath -ldflags "-s -w -X main.version=master -X main.commit=custom -X main.date=custom" -o golangci-lint ./cmd/golangci/main.go -RUN CGO_ENABLED=1 go build -buildmode=plugin -o wrap-err-checker.so ./cmd/plugin/plugin.go +RUN CGO_ENABLED=1 go build -trimpath -ldflags "-s -w -X main.version=master -X main.commit=master -X main.date=custom" -o golangci-lint ./cmd/golangci/main.go +RUN CGO_ENABLED=1 go build -trimpath -ldflags "-s -w" -buildmode=plugin -o wrap-err-checker.so ./cmd/plugin/plugin.go # stage 2 FROM golang:1.20