Skip to content

Commit

Permalink
chore(docker): fix go-sqlite3 requires cgo to work error
Browse files Browse the repository at this point in the history
  • Loading branch information
ngshiheng committed Feb 3, 2024
1 parent 180840f commit 44de753
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.git
.github
.vscode
*.db
**/*.gif
**/*.png
cache/
Expand Down
15 changes: 6 additions & 9 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
FROM golang:1.21-alpine AS go-builder
ENV CGO_ENABLED=1
RUN apk add --no-cache gcc musl-dev
WORKDIR $GOPATH/src/github.com/ngshiheng/michelin-my-maps
COPY go.mod go.sum ./

This comment has been minimized.

Copy link
@ngshiheng

ngshiheng Feb 3, 2024

Author Owner

Unrelated to the fix: this allows Docker to cache the downloaded dependencies. When you rebuild your Docker image, Docker can use the cached layers for the dependencies if the go.mod and go.sum files haven't changed

RUN go mod download
COPY . .
RUN go build -o /bin/mym ./cmd/mym
RUN go build -ldflags='-s -w -extldflags "-static"' -o /bin/mym ./cmd/mym

FROM datasetteproject/datasette
RUN datasette install datasette-publish-vercel

COPY --from=go-builder /bin/mym /bin/mym

ARG VERCEL_TOKEN
ENV VERCEL_TOKEN=${VERCEL_TOKEN}
RUN apt-get update -yq
RUN apt-get -yq install curl gnupg ca-certificates
RUN curl -L https://deb.nodesource.com/setup_18.x | bash
RUN apt-get install -yq nodejs
RUN npm i -g vercel

RUN apt-get update -yq && apt-get -yq install curl gnupg ca-certificates && curl -L https://deb.nodesource.com/setup_18.x | bash && apt-get install -yq nodejs && npm i -g vercel
COPY . .
CMD ["./docker/docker-entrypoint.sh"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/kennygrant/sanitize v1.2.4 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/mattn/go-sqlite3 v1.14.19 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
github.com/temoto/robotstxt v1.1.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/nyaruka/phonenumbers v1.3.1 h1:QcPRnL8hhZeSS6mB0p/Rlv7ma5ASmcgF33YLY0g0A8k=
github.com/nyaruka/phonenumbers v1.3.1/go.mod h1:4jyKp/BFUokLbCHyoZag+T3S1KezFVoEKtgnbpzItC4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down

0 comments on commit 44de753

Please sign in to comment.