wbh1 / grafana-sqlite-to-postgres

Grafana SQLite to Postgres Database Migrator
MIT License
100 stars 26 forks source link

x509: certificate signed by unknown authority #30

Closed 6sossomons closed 1 year ago

6sossomons commented 2 years ago

Found this issue when I was trying to build this today from a brand new Ubuntu 20 (and also on a MAC)

[builder 4/4] RUN make:

9 0.205 go build -o dist/grafana-migrate_linux_amd64-v2.2.0 ./cmd/grafana-migrate

9 0.667 go: github.com/alecthomas/template@v0.0.0-20160405071501-a0175ee3bccc: Get "https://proxy.golang.org/github.com/alecthomas/template/@v/v0.0.0-20160405071501-a0175ee3bccc.mod": x509: certificate signed by unknown authority

9 0.669 make: *** [Makefile:12: build] Error 1


executor failed running [/bin/sh -c make]: exit code: 2

Followed the advice in this stack: https://stackoverflow.com/questions/64462922/docker-multi-stage-build-go-image-x509-certificate-signed-by-unknown-authorit

And updated Dockerfile to now be: <New starting at line 1> FROM golang:1.15 AS builder

RUN apt-get update && apt-get install -y ca-certificates openssl

ARG cert_location=/usr/local/share/ca-certificates

Get certificate from "github.com"

RUN openssl s_client -showcerts -connect github.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM > ${cert_location}/github.crt

Get certificate from "proxy.golang.org"

RUN openssl s_client -showcerts -connect proxy.golang.org:443 </dev/null 2>/dev/null|openssl x509 -outform PEM > ${cert_location}/proxy.golang.crt

Update certificates

RUN update-ca-certificates

WORKDIR /go/src/github.com/wbh1/grafana-sqlite-to-postgres/

and build succeeds without any issues. Not sure what builds on other systems might do, so I didn't fork it yet to merge back, but figured you might have cycles to check/verify/merge
wbh1 commented 1 year ago

Thank you for raising this, as certificate issues can be a pain. However, I am unable to replicate this on my machine with Docker version 20.10.17, build 100c701.

Potentially it was an ephemeral issue upstream?