Skip to content

Commit

Permalink
Merge pull request #16 from pkarakal/11-add-goreleaser
Browse files Browse the repository at this point in the history
Add goreleaser and optimize docker image
  • Loading branch information
dpliakos authored Sep 23, 2023
2 parents a44b63b + 69a66f0 commit 6a2b80d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 16 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/goreleaser.yml
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 }}
27 changes: 11 additions & 16 deletions Dockerfile
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"]

0 comments on commit 6a2b80d

Please sign in to comment.