diff --git a/.github/workflows/container.yml b/.github/workflows/build.yml similarity index 80% rename from .github/workflows/container.yml rename to .github/workflows/build.yml index 33593ec..a3b36d8 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout GitHub Action - uses: actions/checkout@main + uses: actions/checkout@v4 - name: Fetch tags run: git fetch --force --tags @@ -23,14 +23,14 @@ jobs: run: echo ${{github.ref_name}} - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} - name: Build Image - run: docker build . --tag ghcr.io/phpgeeks-club/geeksonator:${{github.ref_name}} + run: docker build -t ghcr.io/phpgeeks-club/geeksonator:${{github.ref_name}} . - name: Push Image run: docker push ghcr.io/phpgeeks-club/geeksonator:${{github.ref_name}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 2d21e6f..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: goreleaser - -on: - push: - # run only against tags - tags: - - "*" - -permissions: - contents: write - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout GitHub Action - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Fetch tags - run: git fetch --force --tags - - - name: Display tag - run: echo ${{github.ref_name}} - - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: stable - - - name: Display Go version - run: go version - - - name: Create release - uses: goreleaser/goreleaser-action@v5 - with: - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml deleted file mode 100644 index 21461a6..0000000 --- a/.goreleaser.yaml +++ /dev/null @@ -1,15 +0,0 @@ -project_name: geeksonator -builds: - - id: geeksonator - env: - - CGO_ENABLED=0 - goos: - - linux - goarch: - - amd64 - flags: - - -trimpath - ldflags: - - -s -w - main: ./cmd/geeksonator - binary: ./bin/geeksonator diff --git a/Dockerfile b/Dockerfile index a0bdd35..74feef2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Run -# docker build -f ./Dockerfile -t geeksonator:latest . +# docker build --no-cache -f ./Dockerfile -t geeksonator:latest . # docker run -d --env-file=/path/to/.env --name geeksonator.app geeksonator:latest . ################################## @@ -34,7 +34,9 @@ WORKDIR /app COPY . . # Build the binary. -RUN make build +RUN go mod tidy +RUN go mod vendor +RUN GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o /app/bin/geeksonator /app/cmd/geeksonator ############################## # STEP 2 build a small image # diff --git a/Makefile b/Makefile index 199d4e8..bd260db 100644 --- a/Makefile +++ b/Makefile @@ -20,17 +20,12 @@ test: .PHONY: docker_build docker_build: - @docker build -f ./Dockerfile -t geeksonator_dev . + @docker build --no-cache -f ./Dockerfile -t geeksonator_dev . .PHONY: docker_run docker_run: - @GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./bin/geeksonator ./cmd/geeksonator - -.PHONY: build -build: deps - @GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o ./bin/geeksonator ./cmd/geeksonator + @docker run -d --env-file=./.env --name geeksonator.dev geeksonator_dev . .PHONY: tools tools: deps @go install github.com/vektra/mockery/v2@v2.36.0 - @go install github.com/goreleaser/goreleaser@v1.21.2 diff --git a/README.md b/README.md index d32e65a..82e37a7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/phpgeeks-club/admin-bot?style=flat-square)](https://goreportcard.com/report/github.com/phpgeeks-club/admin-bot) [![Audit](https://github.com/phpgeeks-club/admin-bot/actions/workflows/audit.yml/badge.svg?branch=master)](https://github.com/phpgeeks-club/admin-bot/actions/workflows/audit.yml) -![GitHub release (with filter)](https://img.shields.io/github/v/release/phpgeeks-club/admin-bot) ![License](https://img.shields.io/github/license/phpgeeks-club/admin-bot.svg) ## Install