You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would also like to ask @kyleconroy, What would be the best way to include to sqlc in the Docker build process?
I have a typical docker image like:
WORKDIR /build
ADD go.mod go.sum vendor ./
ADD . .
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -installsuffix nocgo -o /manager ./manager
BUT, now I would also like to perform the sqlc generate before building my program's binary.
I was thinking about doing something like this:
FROM golang:1.15.2-buster AS builder
WORKDIR /go
RUN go get -u github.com/tmthrgd/go-bindata
RUN go get -u github.com/kyleconroy/sqlc/cmd/sqlc
WORKDIR /build
ADD go.mod go.sum vendor ./
ADD . .
// NOTICE THIS TO GENERATE QUERIES
// NOTICE THIS TO GENERATE QUERIES
// NOTICE THIS TO GENERATE QUERIES
RUN sqlc generate
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -installsuffix nocgo -o /manager ./manager
But this is failing atm right in the go get part for the master and I would like to lock sqlc to a specific version. 1.5.0 or this incoming 1.6.0.
=> ERROR [4/4] RUN go get github.com/kyleconroy/sqlc/cmd/sqlc 90.1s
------
> [4/4] RUN go get github.com/kyleconroy/sqlc/cmd/sqlc:
#7 72.66 # github.com/kyleconroy/sqlc/internal/engine/dolphin
#7 72.66 src/github.com/kyleconroy/sqlc/internal/engine/dolphin/convert.go:303:28: n.OldTable undefined (type *"github.com/pingcap/parser/ast".RenameTableStmt has no field or method OldTable)
How would you recommend to include the sqlc in the docker building process please?
Update:
For now, it seems I got it working with:
ADD https://github.com/kyleconroy/sqlc/releases/download/v1.5.0/sqlc-v1.5.0-linux-amd64.tar.gz ./
RUN tar -xzf ./sqlc-v1.5.0-linux-amd64.tar.gz --directory ./bin/
And then:
RUN cd identities && sqlc generate
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -a -installsuffix nocgo -o /manager ./manager
Activity
kyleconroy commentedon Nov 16, 2020
Yes! The plan is to release the next version, now 2.0.0 due to MySQL breaking changes, this week. Sorry for the long wait.
kyleconroy commentedon Nov 19, 2020
Welp, it's going to be v1.6.0 because Go module version is strange. But the version is coming soon!
EnchanterIO commentedon Nov 22, 2020
+1.
I would also like to ask @kyleconroy, What would be the best way to include to
sqlcin the Docker build process?I have a typical docker image like:
BUT, now I would also like to perform the
sqlc generatebefore building my program's binary.I was thinking about doing something like this:
But this is failing atm right in the
go getpart for the master and I would like to locksqlcto a specific version. 1.5.0 or this incoming 1.6.0.How would you recommend to include the
sqlcin the docker building process please?Update:
For now, it seems I got it working with:
And then:
But not if there is a better way.
kyleconroy commentedon Nov 22, 2020
@EnchanterIO I've moved your comment to a new discussion, hope that's okay.
kevinburke1 commentedon Nov 22, 2020
FWIW, we have Ubuntu sqlc packages available here https://packagecloud.io/app/meter/public/search?q=sqlc
kyleconroy commentedon Nov 23, 2020
v1.6.0 has been tagged. My release script is currently broken, so I don't think it will land on brew, docker, etc. until tomorrow afternoon.
kyleconroy commentedon Nov 24, 2020
Docker, Equinox, Homebrew, Snapcraft and GitHub releases are now all up to date.