sirmark/golang

By sirmark

Updated 14 days ago

Go (golang) Alpine Docker image with glibc packages.

Image
Languages & frameworks
1

866

sirmark/golang repository overview

Go (golang) Docker image with Alpine-glibc

This image based on Go (golang) official image, and contains glibc to enable proprietary projects compiled against glibc work on Alpine.

This image includes some quirks to make glibc work side by side with musl libc (default in Alpine Linux). glibc packages for Alpine Linux are prepared by Sasha Gerrand and the releases are published in sgerrand/alpine-pkg-glibc github repo.

If you need to update your libc library cache, use /usr/glibc-compat/sbin/ldconfig instead of the usual /sbin/ldconfig. You can also use the LD_LIBRARY_PATH as on standard libc-based distributions.

No latest tag, please use specific version tags.

Docker Pull Command

docker pull sirmark/golang:1.26-alpine-glibc2.42

Usage Example

Pull and run.

$ docker pull sirmark/golang:1.26-alpine-glibc2.42
$ docker run --rm -it sirmark/golang:1.26-alpine-glibc2.42

Use in your Dockerfile, writing something along the lines of the following will compile and run your project:

FROM sirmark/golang:1.26-alpine-glibc2.42

WORKDIR /usr/src/app

# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify

COPY . .
RUN go build -v -o /usr/local/bin/app ./...

CMD ["app"]

Then, build and run the Docker image:

$ docker build -t my-golang-app .
$ docker run -it --rm --name my-running-app my-golang-app

Tag summary

Content type

Image

Digest

sha256:ccc928030

Size

72.2 MB

Last updated

14 days ago

docker pull sirmark/golang:1.26-alpine-glibc2.42