lifadev / archive_aws-lambda-go-shim

Author your AWS Lambda functions in Go, effectively.

Home Page:https://github.com/eawsy/aws-lambda-go-shim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image with alpine linux

sandangel opened this issue · comments

I tried to build an image from alpine linux with this Dockerfile.base

FROM golang:alpine

ENV PKG_CONFIG_PATH /usr/lib/pkgconfig

ENV PACKAGES="\
 bash \
 git \
 findutils \
 build-base \
 ca-certificates \
 python2 \
 python2-dev \
 zip \
 pkgconf \
"

RUN apk update \
&& apk upgrade \
&& apk add --no-cache $PACKAGES \
&& ln -s $PKG_CONFIG_PATH/python-2.7.pc $PKG_CONFIG_PATH/python2.7.pc \

It can build code successfully in local env but when I upload .zip file to aws lambda, it had an error when executing function:

START RequestId: 36ac546c-3390-11e7-ab02-71150c75a5ff Version: $LATEST
Unable to import module 'handler': libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory

It seem like there 's a problem with musl package so I 've installed musl but it not fixed.

Can you create an alpine image instead of Amazon linux, I think it will be much smaller in size.

Hi @sandangel
Alpine relies on libmusl which is a functionally equivalent version of glibc with a different licensing.
The problem is that libmusl has not an ABI compatible with glibc, but CGO relies on glibc. So we cannot use bare Alpine image in place of the Amazon Linux one. And if you try to install glibc on Alpine (which is a pretty hard task), you end up with a heavy size image. In addition to these reasons, we rely on Amazon Linux image because this image is the exact equivalent of the AWS Lambda runtime os.
Sorry, but I'm afraid I cannot take action on this issue.