Skip to content

Instantly share code, notes, and snippets.

@CodaBool
Last active October 25, 2024 23:39
Show Gist options
  • Save CodaBool/fd6ba2d6da40c7beaf6e789657446d42 to your computer and use it in GitHub Desktop.
Save CodaBool/fd6ba2d6da40c7beaf6e789657446d42 to your computer and use it in GitHub Desktop.
AL2 lambda with a Go github release
FROM public.ecr.aws/lambda/provided:al2
# there is a https://hub.docker.com/r/microsoft/mssql-tools image but it does not have the lambda runtime
# there likely is a way to install using the microsoft yum/Fedora repo
# but this AL2 does not have yum-config-manager
# which makes it difficult to add GPG keys
ARG VERSION=v1.8.0
# install tar and bzip to decompress archive
RUN yum install -y tar bzip2 && yum clean all
# RUN curl -L -O https://github.com/microsoft/go-sqlcmd/releases/latest/download/sqlcmd-linux-amd64.tar.bz2
# download & verify checksum
# https://github.com/microsoft/go-sqlcmd/releases/
ADD --checksum=sha256:f748fa33eae645db1e05a07d990d0d2a8025cd319b6f7f0461e00eed18c865b4 \
https://github.com/microsoft/go-sqlcmd/releases/download/$VERSION/sqlcmd-linux-amd64.tar.bz2 \
sqlcmd-linux-amd64.tar.bz2
RUN tar -xvjf sqlcmd-linux-amd64.tar.bz2 && rm *.bz2 sqlcmd_debug
ENTRYPOINT ["sqlcmd"]
@CodaBool
Copy link
Author

CodaBool commented Oct 25, 2024

FINAL IMAGE IS 356Mb

can get a new sha256 value with

VERSION=v1.8.0
curl -L -O "https://github.com/microsoft/go-sqlcmd/releases/download/$VERSION/sqlcmd-linux-amd64.tar.bz2"
sha256sum sqlcmd-linux-amd64.tar.bz2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment