-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from pkarakal/11-add-goreleaser
Add goreleaser and optimize docker image
- Loading branch information
Showing
2 changed files
with
39 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
FROM golang:1.18.3-alpine | ||
FROM golang:1.18.3-alpine as build | ||
|
||
RUN mkdir -p /go/src/github.com/dpliakos/jorge | ||
WORKDIR /go/src/github.com/dpliakos/jorge | ||
WORKDIR /app | ||
COPY go.mod go.sum /app/ | ||
RUN go mod download | ||
|
||
RUN apk add make | ||
COPY . . | ||
RUN go build | ||
|
||
COPY ./main.go . | ||
COPY ./cmd ./cmd | ||
COPY ./internal ./internal | ||
COPY ./go.mod . | ||
COPY ./go.sum . | ||
COPY ./LICENSE . | ||
COPY ./Makefile . | ||
FROM alpine:3.17.5 as final | ||
|
||
RUN go get | ||
RUN make build | ||
RUN make install | ||
USER 1000 | ||
COPY --from=build /app/jorge /jorge | ||
|
||
RUN mkdir /root/projectRoot | ||
WORKDIR /root/projectRoot | ||
WORKDIR /projectRoot | ||
ENTRYPOINT ["/jorge"] |