Skip to content

Commit

Permalink
Merge pull request #38 from guitmz/log-not-panic
Browse files Browse the repository at this point in the history
using log instead of panic and distroless containers
  • Loading branch information
guitmz authored Apr 19, 2023
2 parents 3ba9c0c + 5d69cb9 commit ffa147f
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 649 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to Docker Hub
uses: docker/login-action@v1
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Docker meta
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/n26
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push
uses: docker/build-push-action@v3
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
Expand All @@ -38,4 +33,3 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/n26:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/n26:buildcache,mode=max

15 changes: 5 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ FROM golang AS build-env

ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
GOOS=linux

COPY . /go/src/github.com/guitmz/n26
WORKDIR /go/src/github.com/guitmz/n26

RUN go mod download
RUN go install -v -a -ldflags '-s -w -extldflags "-static"' github.com/guitmz/n26/cmd/n26
RUN go mod download \
&& go install -v -a -ldflags '-s -w -extldflags "-static"' github.com/guitmz/n26/cmd/n26

# final stage
FROM alpine

FROM gcr.io/distroless/static-debian11
COPY --from=build-env /go/bin/n26 /

RUN apk add --no-cache ca-certificates tzdata

ENTRYPOINT [ "/n26" ]
CMD [ "/n26" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/guitmz/n26.svg?branch=master)](https://travis-ci.org/guitmz/n26) [![Go Report Card](https://goreportcard.com/badge/github.com/guitmz/n26)](https://goreportcard.com/report/github.com/guitmz/n26) [![](https://images.microbadger.com/badges/image/guitmz/n26.svg)](https://microbadger.com/images/guitmz/n26 "Get your own image badge on microbadger.com")
[![Go Report Card](https://goreportcard.com/badge/github.com/guitmz/n26)](https://goreportcard.com/report/github.com/guitmz/n26) [![](https://images.microbadger.com/badges/image/guitmz/n26.svg)](https://microbadger.com/images/guitmz/n26 "Get your own image badge on microbadger.com")

# n26
Go API and CLI to get information of your N26 account
Expand Down
3 changes: 2 additions & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"

Expand Down Expand Up @@ -433,6 +434,6 @@ func (auth *Client) GetSpaces(retType string) (string, *Spaces) {

func check(e error) {
if e != nil {
panic(e)
log.Fatal(e.Error())
}
}
5 changes: 3 additions & 2 deletions cmd/n26/n26.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
"io"
"log"
"os"
"sort"
"strconv"
Expand All @@ -16,12 +17,12 @@ import (
)

const (
appVersion = "1.5.5"
appVersion = "1.5.6"
)

func check(e error) {
if e != nil {
panic(e)
log.Fatal(e.Error())
}
}

Expand Down
16 changes: 11 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ module github.com/guitmz/n26
go 1.14

require (
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
github.com/olekukonko/tablewriter v0.0.4
github.com/urfave/cli v1.22.4
golang.org/x/net v0.0.0-20220630215102-69896b714898 // indirect
golang.org/x/oauth2 v0.0.0-20220630143837-2104d58473e0
github.com/golang/protobuf v1.5.3 // indirect
github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef
github.com/kr/pretty v0.1.0 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/olekukonko/tablewriter v0.0.5
github.com/rivo/uniseg v0.4.4 // indirect
github.com/urfave/cli v1.22.12
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/oauth2 v0.7.0
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
Loading

0 comments on commit ffa147f

Please sign in to comment.