diff --git a/.gitea/workflows/build-publish.yaml b/.gitea/workflows/build-publish.yaml new file mode 100644 index 0000000..bc103af --- /dev/null +++ b/.gitea/workflows/build-publish.yaml @@ -0,0 +1,30 @@ +name: ci + +on: + push: + branches: [ main, techknowlogick-patch-1 ] + +jobs: + docker: + strategy: + matrix: + arch: ['arm64', 'amd64'] + go-version: ['1.20'] + git-version: ['2.38.4'] + golangci-lint-version: ['1.51.0'] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: setup buildx + uses: https://github.com/docker/setup-buildx-action@v2 + - name: build image + uses: https://github.com/docker/build-push-action@v4 + with: + push: false + tags: gitea/test_env:${{ matrix.arch }} + build-args: | + GOLANG_VERSION=${{ matrix.go-version }} + GIT_VERSION=${{ matrix.git-version }} + GOLANGCI_LINT_VERSION=${{ matrix.golangci-lint-version }} + + diff --git a/.gitea/workflows/dry-run.yaml b/.gitea/workflows/dry-run.yaml new file mode 100644 index 0000000..09b24e1 --- /dev/null +++ b/.gitea/workflows/dry-run.yaml @@ -0,0 +1,29 @@ +name: ci + +on: + pull_request: + +jobs: + docker: + strategy: + matrix: + arch: ['arm64', 'amd64'] + go-version: ['1.20'] + git-version: ['2.38.4'] + golangci-lint-version: ['1.51.0'] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: setup buildx + uses: https://github.com/docker/setup-buildx-action@v2 + - name: build image + uses: https://github.com/docker/build-push-action@v4 + with: + push: false + tags: gitea/test_env:${{ matrix.arch }} + build-args: | + GOLANG_VERSION=${{ matrix.go-version }} + GIT_VERSION=${{ matrix.git-version }} + GOLANGCI_LINT_VERSION=${{ matrix.golangci-lint-version }} + + diff --git a/Dockerfile b/Dockerfile index 2a11b77..ac0cdc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM golang:1.20-bullseye +ARG GOLANG_VERSION=1.20 +ARG GIT_VERSION=2.38.4 +ARG GOLANGCI_LINT_VERSION=1.51.0 +FROM golang:${GOLANG_VERSION}}-bullseye ARG GITEA_ID=1000 ARG GITEA_GID=1000 @@ -12,17 +15,17 @@ RUN addgroup \ --gid $GITEA_GID \ gitea -# version-lock git to v2.38.4 to match alpine 3.17 -RUN curl -SL https://github.com/git/git/archive/v2.38.4.tar.gz \ +# version-lock git to v${GIT_VERSION} to match alpine 3.17 +RUN curl -SL https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz \ | tar -xzv -C /go \ && apt-get update \ && apt-get install -y libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev \ - && make -C /go/git-2.38.4 prefix=/usr all \ - && make -C /go/git-2.38.4 prefix=/usr install \ - && rm -rf /go/git-2.38.4 \ + && make -C /go/git-${GIT_VERSION} prefix=/usr all \ + && make -C /go/git-${GIT_VERSION} prefix=/usr install \ + && rm -rf /go/git-${GIT_VERSION} \ # install git-lfs && curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \ && apt-get install -y git-lfs \ # install golangci-lint - && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0 \ + && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION} \ && golangci-lint --version