From a0e9d5cc5b2a5190dc5fe28c2fee1afb021e5c91 Mon Sep 17 00:00:00 2001 From: Javier Juarez Date: Sat, 14 Oct 2023 08:40:42 +0200 Subject: [PATCH] Feature: General updates (#2) * chore: Updates to go 1.21 and Alpine Linux 3.18 * fix: Some files that are not needed in the context * feat: Adds the docker target flag * chore: Update modules --------- Co-authored-by: javier.juarez --- .dockerignore | 4 ++-- Dockerfile | 4 ++-- Makefile | 4 +++- go.mod | 12 +++++++----- go.sum | 12 ++++++++++++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.dockerignore b/.dockerignore index f941c8c..6c44432 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,11 +1,11 @@ .git .gitignore .dockerignore -.ci +.envrc +ci dist Dockerfile Makefile -Makefile.mk README.md CHANGELOG.md LICENSE diff --git a/Dockerfile b/Dockerfile index d0f691c..8b30071 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.4 -FROM golang:1.19-alpine3.17 AS builder +FROM golang:1.21-alpine3.18 AS builder ARG VERSION @@ -10,7 +10,7 @@ COPY . ./ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -ldflags="-X 'github.com/jjuarez/simple-prober/cmd.Version=${VERSION}'" -o dist/simple-prober main.go -FROM alpine:3.17.1 AS runtime +FROM alpine:3.18.4 AS runtime WORKDIR /app RUN mkdir -p config diff --git a/Makefile b/Makefile index 7094283..c6c6699 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ DOCKER_REGISTRY ?= docker.io DOCKER_REGISTRY_NAMESPACE ?= jjuarez DOCKER_SERVICE_NAME ?= simple-prober DOCKER_IMAGE := $(DOCKER_REGISTRY)/$(DOCKER_REGISTRY_NAMESPACE)/$(DOCKER_SERVICE_NAME) +DOCKER_TARGET ?= runtime PROJECT_CHANGESET := $(shell git rev-parse --verify HEAD 2>/dev/null) @@ -69,7 +70,7 @@ docker/login: @echo $(DOCKER_TOKEN)|docker login --username $(DOCKER_USERNAME) --password-stdin $(DOCKER_REGISTRY) .PHONY: docker/build -docker/build: docker/login ## Makes the Docker build and takes care of the remote cache by target +docker/build: ## Makes the Docker build and takes care of the remote cache by target ifdef PROJECT_VERSION @docker image build \ --build-arg BUILDKIT_INLINE_CACHE=1 \ @@ -77,6 +78,7 @@ ifdef PROJECT_VERSION --cache-from $(DOCKER_IMAGE):latest \ --tag $(DOCKER_IMAGE):$(PROJECT_CHANGESET) \ --tag $(DOCKER_IMAGE):latest \ + --target $(DOCKER_TARGET) \ --file Dockerfile \ . else diff --git a/go.mod b/go.mod index dd8b0c9..b848324 100644 --- a/go.mod +++ b/go.mod @@ -2,12 +2,14 @@ module github.com/jjuarez/simple-prober go 1.19 -require github.com/spf13/cobra v1.6.1 +require ( + github.com/sirupsen/logrus v1.9.3 + github.com/spf13/cobra v1.7.0 + gopkg.in/yaml.v3 v3.0.1 +) require ( - github.com/inconshreveable/mousetrap v1.0.1 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + golang.org/x/sys v0.13.0 // indirect ) diff --git a/go.sum b/go.sum index 2e0f7fd..f0612bf 100644 --- a/go.sum +++ b/go.sum @@ -1,20 +1,32 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=