Skip to content

Commit bf2497e

Browse files
authored
feat: get rid of cgo (#31)
This replaces the gorm sqlite driver by a native go driver maintained by glebarez and officially supported by gorm. Resolves #27.
1 parent 36bab3d commit bf2497e

File tree

4 files changed

+177
-26
lines changed

4 files changed

+177
-26
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY main.go ./
1313
RUN go build -o /backend
1414

1515
# Build final image
16-
FROM alpine:3.15.1
17-
WORKDIR /app
18-
COPY --from=builder /backend /app/backend
19-
ENTRYPOINT ["/app/backend"]
16+
FROM scratch
17+
WORKDIR /
18+
COPY --from=builder /backend /backend
19+
ENTRYPOINT ["/backend"]

go.mod

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ go 1.18
44

55
require (
66
github.com/gin-gonic/gin v1.7.7
7+
github.com/glebarez/sqlite v1.4.1
78
github.com/shopspring/decimal v1.3.1
8-
gorm.io/driver/sqlite v1.3.1
9+
gorm.io/driver/postgres v1.3.1
910
gorm.io/gorm v1.23.3
1011
)
1112

1213
require (
1314
github.com/davecgh/go-spew v1.1.1 // indirect
15+
github.com/gin-contrib/sse v0.1.0 // indirect
16+
github.com/glebarez/go-sqlite v1.15.1 // indirect
17+
github.com/go-playground/locales v0.14.0 // indirect
18+
github.com/go-playground/universal-translator v0.18.0 // indirect
19+
github.com/go-playground/validator/v10 v10.10.0 // indirect
20+
github.com/golang/protobuf v1.5.2 // indirect
21+
github.com/google/uuid v1.3.0 // indirect
1422
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
1523
github.com/jackc/pgconn v1.10.1 // indirect
1624
github.com/jackc/pgio v1.0.0 // indirect
@@ -19,32 +27,27 @@ require (
1927
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
2028
github.com/jackc/pgtype v1.9.1 // indirect
2129
github.com/jackc/pgx/v4 v4.14.1 // indirect
22-
github.com/pmezard/go-difflib v1.0.0 // indirect
23-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
24-
)
25-
26-
require (
27-
github.com/gin-contrib/sse v0.1.0 // indirect
28-
github.com/go-playground/locales v0.14.0 // indirect
29-
github.com/go-playground/universal-translator v0.18.0 // indirect
30-
github.com/go-playground/validator/v10 v10.10.0 // indirect
31-
github.com/golang/protobuf v1.5.2 // indirect
3230
github.com/jinzhu/inflection v1.0.0 // indirect
3331
github.com/jinzhu/now v1.1.4 // indirect
3432
github.com/json-iterator/go v1.1.12 // indirect
3533
github.com/leodido/go-urn v1.2.1 // indirect
3634
github.com/mattn/go-isatty v0.0.14 // indirect
37-
github.com/mattn/go-sqlite3 v1.14.12 // indirect
3835
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3936
github.com/modern-go/reflect2 v1.0.2 // indirect
37+
github.com/pmezard/go-difflib v1.0.0 // indirect
38+
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
4039
github.com/stretchr/testify v1.7.1
4140
github.com/ugorji/go/codec v1.2.7 // indirect
4241
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
43-
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
42+
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
4443
golang.org/x/text v0.3.7 // indirect
4544
google.golang.org/protobuf v1.27.1 // indirect
4645
gopkg.in/yaml.v2 v2.4.0 // indirect
47-
gorm.io/driver/postgres v1.3.1
46+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
47+
modernc.org/libc v1.14.12 // indirect
48+
modernc.org/mathutil v1.4.1 // indirect
49+
modernc.org/memory v1.0.7 // indirect
50+
modernc.org/sqlite v1.15.2 // indirect
4851
)
4952

5053
replace github.com/envelope-zero/backend/internal/routing => ./internal/routing

0 commit comments

Comments
 (0)