I'm trying to build my app which contains go-sqlite3 by docker.
main.go
package main
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
func main() {
sql.Open("sqlite3", "test.db")
}
Dockerfile
FROM golang:alpine
RUN apk add --no-cache git
RUN apk add --no-cache sqlite-libs sqlite-dev
RUN apk add --no-cache build-base
WORKDIR /go/src/app
COPY *.go ./
RUN go-wrapper download
RUN go-wrapper install
I use this command to copy the compiled program out to my host OS (Arch Linux).
docker build -t mygo .
docker run --rm -v $$PWD:/usr/src/app mygo /bin/cp /go/bin/app /usr/src/app
The problem is the compiled program is missing dynamic library
$ ldd app
...
libc.musl-x86_64.so.1 => not found
What I expected is like
$ ldd app
not a dynamic executable