@tobi: golang alpine image with cgo for sqlite3

Picking up go is a lot of fun! So does a few of my colleagues :-)

Tobi M. (“the destroyer”) asked if i have a solution to run a golang docker image with the go-sqlite3 driver

I remembered to had the same problem, so after my post about really small docker images, lets add a few more bytes!

the solution

This solution is not my own, i found and tried other solutions but stayed with this Dockerfile on github

FROM alpine

RUN apk --update upgrade
RUN apk add sqlite
# See http://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2

# removing apk cache
RUN rm -rf /var/cache/apk/*

# YOUR CODE!

Compared to a plain alpine image, we need now ~7MB more space.

HINT: don’t forget to build the binary with CGO!

Last posts

Tags